Rc link preset 2026.6 compatibility #2000
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: 'Deployment' | |
| on: | |
| pull_request_target: | |
| branches: | |
| - master | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| # Job 1: Build the code (no secrets here) | |
| build: | |
| permissions: | |
| actions: read | |
| contents: read | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| persist-credentials: false | |
| - name: Setup node | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 20 | |
| - name: Run the checker script | |
| if: github.ref != 'refs/heads/master' || github.repository_owner != 'betaflight' | |
| run: ./scripts/build.sh | |
| - name: Run the checker, indexer and deployment script | |
| if: github.ref == 'refs/heads/master' && github.repository_owner == 'betaflight' && github.event_name == 'push' | |
| run: ./scripts/build.sh deploy | |
| - name: Run the checker, indexer and deployment script (PR) | |
| if: github.event_name == 'pull_request_target' | |
| run: ./scripts/build.sh deploy | |
| - name: Upload build artifact | |
| if: (github.ref == 'refs/heads/master' && github.repository_owner == 'betaflight' && github.event_name == 'push') || github.event_name == 'pull_request_target' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-files | |
| path: public | |
| retention-days: 7 | |
| # Job 2: Deploy with secrets (no PR code checkout) | |
| deploy: | |
| needs: build | |
| permissions: | |
| actions: read | |
| contents: read | |
| deployments: write | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| if: (github.ref == 'refs/heads/master' && github.repository_owner == 'betaflight') || github.event_name == 'pull_request_target' | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Download build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist-files | |
| path: public | |
| - name: Set alias branch name for Cloudflare (if a push) | |
| id: branch_push | |
| if: github.event_name == 'push' | |
| run: | | |
| echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV | |
| - name: Set alias branch name for Cloudflare (if a pull_request) | |
| id: branch_pull | |
| if: github.event_name == 'pull_request_target' | |
| run: | | |
| echo "BRANCH=PR${{ github.event.pull_request.number }}" >> $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 public --project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }} --branch=${{ env.BRANCH }} --commit-dirty=true | |
| - name: Add deployment comment | |
| if: github.event_name == 'pull_request_target' | |
| uses: thollander/actions-comment-pull-request@v3 | |
| with: | |
| message: | | |
| Preview URL: ${{ steps.deploy.outputs.pages-deployment-alias-url }} | |
| comment-tag: 'Preview URL' | |
| mode: recreate |