添加自动部署Actions (#1)
FTP_USER FTP_PASSWD FTP_IP 稍后完成key设置(WIP删除表示已完成) 不要乱改actions! Reviewed-on: study-area-cn/study-area-cn-homepage#1
This commit is contained in:
parent
121001dc1c
commit
a8f49b285a
|
@ -0,0 +1,78 @@
|
|||
name: Build and Publish
|
||||
run-name: Build and Publish homepage (${{ gitea.actor }})
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Run:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Info
|
||||
run: echo "OS=${{ runner.os }} NAME=${{ gitea.event_name }} REPO=${{ gitea.repository }} BRANCH=${{ gitea.ref }} ST=${{ job.status }} RUNID=${{ gitea.run_id }}"
|
||||
- name: Prepare Source
|
||||
run: |
|
||||
echo "--- write source ---"
|
||||
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free">/etc/apt/sources.list
|
||||
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free">>/etc/apt/sources.list
|
||||
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free">>/etc/apt/sources.list
|
||||
cat /etc/apt/sources.list
|
||||
rm -rf /etc/apt/sources.list.d/*
|
||||
echo "--- update source ---"
|
||||
apt-get update
|
||||
- name: Prepare Lftp
|
||||
run: |
|
||||
apt-get install lftp -y
|
||||
- name: Checkout
|
||||
uses: http://git.hmtsai.cn/actions/checkout@v4
|
||||
- name: Cache Node
|
||||
uses: https://git.hmtsai.cn/actions/cache@v4
|
||||
id: cache-node
|
||||
env:
|
||||
cache-name: cache-node
|
||||
with:
|
||||
key: ${{ runner.os }}-node
|
||||
path: |
|
||||
/node
|
||||
- name: Prepare node
|
||||
if: ${{ steps.cache-node.outputs.cache-hit != 'true' }}
|
||||
run: |
|
||||
git clone https://git.hmtsai.cn/cxykevin/study-area-home-action-deps
|
||||
mv study-area-home-action-deps/node-$(uname -m).tar.xz study-area-home-action-deps/node.tar.xz
|
||||
tar xvJf study-area-home-action-deps/node.tar.xz
|
||||
mv node-*-linux-* /node
|
||||
export PATH=/node/bin:$PATH
|
||||
echo $PATH
|
||||
- name: Get Hash
|
||||
id: npm_hash
|
||||
run: echo "::set-output name=npmhash::$(sha256sum ./package.json | cut -d ' ' -f 1)"
|
||||
- name: Cache Node Moudles
|
||||
id: cache-node-moudles
|
||||
uses: https://git.hmtsai.cn/actions/cache@v4
|
||||
env:
|
||||
cache-name: cache-node-moudles
|
||||
with:
|
||||
key: ${{ runner.os }}-node_moudles-${{ steps.npm_hash.outputs.npmhash }}
|
||||
path: |
|
||||
node_modules
|
||||
- name: Check node
|
||||
run: |
|
||||
node -v
|
||||
npm -v
|
||||
- name: Prepare NPM source
|
||||
run: |
|
||||
export PATH=/node/bin:$PATH
|
||||
npm config set registry https://registry.npmmirror.com
|
||||
- name: npm install
|
||||
if: ${{ steps.cache-node-moudles.outputs.cache-hit != 'true' }}
|
||||
run: |
|
||||
export PATH=/node/bin:$PATH
|
||||
npm install
|
||||
- name: Build book
|
||||
run: |
|
||||
export PATH=/node/bin:$PATH
|
||||
npm run build
|
||||
- name: Check book
|
||||
run: |
|
||||
echo "# ls dist"
|
||||
ls dist
|
||||
- name: Upload
|
||||
run: lftp ${{ secrets.FTP_IP }} -u ${{ secrets.FTP_USER }},${{ secrets.FTP_PASSWD }} -e "mirror -R dist dist"
|
|
@ -5,6 +5,7 @@
|
|||
"module": "ESNext",
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"skipLibCheck": true,
|
||||
"noImplicitAny": false,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
|
|
Loading…
Reference in New Issue