Build and deploy main branch #253
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
| name: Build and deploy main branch | |
| on: | |
| schedule: | |
| - cron: '47 04 * * 1' # At 04:47 on Monday. | |
| push: | |
| branches: [ "main" ] | |
| # uncomment the following two lines while developing the CI | |
| # pull_request: | |
| # branches: [ "main" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - uses: cachix/install-nix-action@v26 | |
| - uses: cachix/cachix-action@v14 | |
| with: | |
| name: devenv | |
| - name: Install devenv.sh | |
| run: nix profile install nixpkgs#devenv | |
| - name: Test | |
| run: | | |
| devenv test | |
| - name: Build | |
| run: | | |
| devenv shell npm run build | |
| - name: Upload static HTML artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: static-html | |
| path: dist/ | |
| deploy-main-to-branch: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' || github.event_name == 'schedule' | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download static HTML artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: static-html | |
| path: dist | |
| - name: Deploy to branch | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| folder: dist | |
| branch: dist | |
| single-commit: true | |
| deploy-main-to-prod: | |
| needs: deploy-main-to-branch | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Call PROD_DEPLOY_WEBHOOK | |
| run: | | |
| curl -X POST ${{ secrets.PROD_DEPLOY_WEBHOOK }} |