Added CHIRP flight mode title #111
Workflow file for this run
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: 'Preview Deployment' | |
on: | |
pull_request_target: | |
types: [opened, synchronize, reopened] | |
branches: | |
- master | |
jobs: | |
# Job 1: Build the code (no secrets here) | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
persist-credentials: false # Don't persist GitHub token | |
- name: Cache node_modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules/ | |
key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
- name: Install node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- run: npm install yarn -g | |
- run: yarn install | |
- run: yarn build | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-files | |
path: dist | |
# Job 2: Deploy with secrets (no PR code checkout) | |
deploy: | |
needs: build # Wait for build job to complete | |
permissions: | |
actions: read | |
contents: read | |
deployments: write | |
issues: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Download build artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist-files | |
path: dist | |
- name: Set short git commit SHA | |
id: vars | |
run: | | |
calculatedSha=$(echo ${{ github.event.pull_request.head.sha }} | head -c 8) | |
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV | |
- name: Deploy to Cloudflare | |
id: deploy | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: pages deploy dist --project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }} --branch=${{ env.COMMIT_SHORT_SHA }} --commit-dirty=true | |
- name: Add deployment comment | |
uses: thollander/actions-comment-pull-request@v3 | |
with: | |
message: | | |
Preview URL: ${{ steps.deploy.outputs.pages-deployment-alias-url }} | |
reactions: eyes, rocket | |
comment-tag: 'Preview URL' | |
mode: recreate |