Deploy website #17
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: Deploy website | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'website/**' | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| environment: release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| deployments: write | |
| statuses: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout main branch | |
| uses: actions/checkout@v4 | |
| - name: Deploy website directory to website branch | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./website | |
| publish_branch: website | |
| keep_files: true | |
| destination_dir: api | |
| user_name: 'github-actions[bot]' | |
| user_email: 'github-actions[bot]@users.noreply.github.com' | |
| commit_message: ${{ github.event.head_commit.message }} | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| pip install cryptography scratchattach | |
| - name: Generate Vercel secrets as environment variables (securely) | |
| id: generate_vars | |
| env: | |
| FERNET_KEY: ${{ secrets.FERNET_KEY }} | |
| run: | | |
| cd tests | |
| eval "$(python -m util vercel | awk ' | |
| NR==1 {print "echo \"vercel_token="$0"\" >> $GITHUB_ENV"} | |
| NR==2 {print "echo \"org_id="$0"\" >> $GITHUB_ENV"} | |
| NR==3 {print "echo \"project_id="$0"\" >> $GITHUB_ENV"}')" | |
| cd .. | |
| shell: bash | |
| - name: Checkout website branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: 'website' | |
| - uses: nexterias/actions-vercel@v1 | |
| id: vercel | |
| with: | |
| token: ${{ env.vercel_token }} | |
| org-id: ${{ env.org_id }} | |
| project-id: ${{ env.project_id }} | |
| production: true | |
| prebuilt: true |