Skip to content

feat(version): 更新至测试版1.21.30.24 #107

feat(version): 更新至测试版1.21.30.24

feat(version): 更新至测试版1.21.30.24 #107

Workflow file for this run

name: Deploy
on:
push:
branches: [ "master" ]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Checkout database
uses: actions/checkout@v4
with:
path: database
- name: Install and export database
working-directory: ${{ github.workspace }}/database
run: |
npm install
npm run generate-all
- name: Checkout web
uses: actions/checkout@v4
with:
repository: XeroAlpha/caidlistweb
path: web
- name: Copy database files
run: |
cp -r ${{ github.workspace }}/database/output/web ${{ github.workspace }}/web/public/data
cp ${{ github.workspace }}/database/output/web/index.json ${{ github.workspace }}/web/src/assets/dataIndex.json
- name: Install and build web
working-directory: ${{ github.workspace }}/web
run: |
yarn install
yarn build
- name: Deploy to self-hosted site
if: github.repository == 'XeroAlpha/caidlist'
run: |
pushd ${{ github.workspace }}/web/dist
tar -cvzf ${{ github.workspace }}/idlist.tar.gz *
popd
echo "${{ secrets.SSH_KEY }}" > ${{ github.workspace }}/key.txt
chmod 400 ${{ github.workspace }}/key.txt
scp -q -P ${{ secrets.PORT }} -o StrictHostKeyChecking=no -i ${{ github.workspace }}/key.txt ${{ github.workspace }}/idlist.tar.gz "${{ secrets.USERNAME }}"@"${{ secrets.HOST }}":/tmp/idlist.tar.gz
ssh -q -p ${{ secrets.PORT }} -o StrictHostKeyChecking=no -i ${{ github.workspace }}/key.txt "${{ secrets.USERNAME }}"@"${{ secrets.HOST }}" "rm -rf ${{ secrets.TARGET_PATH }}/* && tar -xvzf /tmp/idlist.tar.gz -C ${{ secrets.TARGET_PATH }} && rm -f /tmp/idlist.tar.gz"
rm ${{ github.workspace }}/key.txt
- name: Setup GitHub Pages
id: pages_setup
uses: actions/configure-pages@v4
continue-on-error: true
- name: Upload artifact to GitHub pages
if: ${{ steps.pages_setup.outcome == 'success' }}
uses: actions/upload-pages-artifact@v3
with:
path: ${{ github.workspace }}/web/dist
- name: Deploy to GitHub Pages
if: ${{ steps.pages_setup.outcome == 'success' }}
id: deployment
uses: actions/deploy-pages@v4