Content: Add MADFLIGHT_FC3 board doc #189
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 | |
| deployments: write | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| 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: Setup node | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| cache-dependency-path: ./package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build package | |
| id: build-package | |
| run: npm run build | |
| env: | |
| BASE_PATH: / | |
| URL: https://betaflight.com | |
| ORG: betaflight | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-files | |
| path: build | |
| # 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 | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Download build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-files | |
| path: build | |
| - 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: 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' || github.event_name == 'pull_request' | |
| 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 build --project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }} --branch=${{ env.BRANCH }} --commit-dirty=true | |
| - name: Add deployment comment | |
| if: github.event_name == 'pull_request_target' || github.event_name == 'pull_request' | |
| uses: thollander/actions-comment-pull-request@v3 | |
| with: | |
| message: | | |
| Preview URL: ${{ steps.deploy.outputs.pages-deployment-alias-url }} | |
| comment-tag: 'Preview URL' | |
| mode: recreate |