fixed typo #26
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
| # .github/workflows/build_deploy.yml | |
| name: Build and Deploy | |
| # Set the following GitHub Secrets: | |
| # SERVER_HOST – the IP or domain of your server | |
| # SERVER_USER – the username for SSH | |
| # SERVER_PASSWORD – password (or switch to using key for SSH key-based auth) | |
| # SERVER_PORT – typically 22 | |
| # SERVER_TARGET – the path on the server where the files should go | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| run_full_deploy: | |
| description: 'Trigger deployment of all static files' | |
| required: false | |
| default: false | |
| type: boolean | |
| env: | |
| server_fingerprint: 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA2zJZx6VkSJC14SILqvzLiR3v8eS0D7Zs7C7771yDwa90UW8JkhK23dk/G8R74kdcWYEOn3kCSr/2rz+UtYThZeWUa5F6BcT/X5Gwh1RAlw5ESxnRr+hiZhYLI7BivVIo5EzecIs0KEojMRUkXI+ClHIcyXBY6grflQFgjZphFMs=' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build Astro project | |
| run: pnpm build | |
| - name: Archive build | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifact | |
| path: dist/ | |
| deploy: | |
| name: Deploy new static files via SFTP | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.run_full_deploy == 'false' }} # Only run deploy if 'run_full_deploy' input is 'false' | |
| env: | |
| onlyNewer: 'true' | |
| options: 'ignore-time verbose=3 delete' | |
| steps: | |
| - name: Download build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-artifact | |
| path: dist/ | |
| - name: Deploy static files via SFTP | |
| uses: pressidium/lftp-mirror-action@v1 | |
| with: | |
| # SFTP credentials | |
| host: ${{ vars.SERVER_HOST }} | |
| port: ${{ vars.SERVER_PORT }} | |
| user: ${{ vars.SERVER_USER }} | |
| pass: ${{ secrets.SERVER_PASSWORD }} | |
| fingerprint: ${{ env.server_fingerprint }} | |
| # lftp settings | |
| onlyNewer: ${{ env.onlyNewer }} | |
| restoreMTime: 'false' | |
| parallel: '3' | |
| # Mirror command options | |
| localDir: './dist/' | |
| remoteDir: ${{ vars.SERVER_TARGET }} | |
| options: ${{ env.options }} | |
| full-deploy: | |
| name: Deploy all static files via SFTP | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: ${{ github.event.inputs.run_full_deploy == 'true' }} # Only run full-deploy if 'run_full_deploy' input is 'true' | |
| env: | |
| onlyNewer: 'false' | |
| options: 'verbose=3 delete' | |
| steps: | |
| - name: Download build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-artifact | |
| path: dist/ | |
| - name: Deploy static files via SFTP | |
| uses: pressidium/lftp-mirror-action@v1 | |
| with: | |
| # SFTP credentials | |
| host: ${{ vars.SERVER_HOST }} | |
| port: ${{ vars.SERVER_PORT }} | |
| user: ${{ vars.SERVER_USER }} | |
| pass: ${{ secrets.SERVER_PASSWORD }} | |
| fingerprint: ${{ env.server_fingerprint }} | |
| # lftp settings | |
| onlyNewer: ${{ env.onlyNewer }} | |
| restoreMTime: 'false' | |
| parallel: '3' | |
| # Mirror command options | |
| localDir: './dist/' | |
| remoteDir: ${{ vars.SERVER_TARGET }} | |
| options: ${{ env.options }} |