FancyWeb deploy #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Copyright (c) OpenIPC https://openipc.org MIT License | |
| # | |
| # deploy.yml — unified deploy to GitHub Pages and external server | |
| # | |
| name: deploy | |
| run-name: FancyWeb deploy | |
| on: | |
| push: | |
| branches: | |
| - 'deploy' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| ref: deploy | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: '24' | |
| - name: Install packages and build | |
| run: | | |
| npm ci | |
| npm run build-main | |
| - name: Create .nojekyll file | |
| run: touch ./dist/.nojekyll | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: './dist/main' | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: './dist/main' | |
| deploy-pages: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| deploy-external: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Download build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: ./dist/main | |
| - name: Deploy via rsync | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
| chmod 600 ~/.ssh/id_rsa | |
| rsync -avz --delete \ | |
| -e "ssh -o StrictHostKeyChecking=no -p ${{ secrets.SSH_PORT }}" \ | |
| ./dist/main/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ vars.DEPLOY_PATH }} |