Sync Upstream Firefox Releases #4
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: Sync Upstream Firefox Releases | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release_candidate: | |
| description: 'Set to true to sync release candidates' | |
| required: false | |
| type: boolean | |
| default: false | |
| workflow_call: | |
| inputs: | |
| release_candidate: | |
| description: 'Set to true to sync release candidates' | |
| required: false | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| check_candidates: | |
| name: Sync Upstream | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v3 | |
| - name: Check if upstream branch already exists | |
| id: check-upstream-branch | |
| run: | | |
| if git ls-remote --heads origin chore/upstream-sync | grep -sw "refs/heads/chore/upstream-sync" > /dev/null; then | |
| echo "branch_exists=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "branch_exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| if: steps.check-upstream-branch.outputs.branch_exists == 'false' | |
| with: | |
| node-version-file: '.nvmrc' | |
| - name: Install dependencies | |
| if: steps.check-upstream-branch.outputs.branch_exists == 'false' | |
| run: npm ci | |
| - name: Setup surfer CI | |
| if: steps.check-upstream-branch.outputs.branch_exists == 'false' | |
| run: | | |
| if [ "${{ github.event.inputs.release_candidate }}" = "false" ]; then | |
| npm run surfer -- ci --brand release | |
| fi | |
| - name: Download Firefox and dependencies | |
| if: steps.check-upstream-branch.outputs.branch_exists == 'false' | |
| run: npm run download | |
| - name: Sync Upstream Releases | |
| if: steps.check-upstream-branch.outputs.branch_exists == 'false' | |
| run: | | |
| if [ "${{ github.event.inputs.release_candidate }}" = "true" ]; then | |
| npm run sync:rc | |
| else | |
| npm run sync | |
| fi | |
| - name: Check if any files changed | |
| id: git-check | |
| run: | | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "files_changed=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "files_changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Get Firefox Version | |
| id: build-data | |
| if: steps.git-check.outputs.files_changed == 'true' | |
| run: | | |
| if [ "${{ github.event.inputs.release_candidate }}" = "true" ]; then | |
| VERSION=$(node -pe "require('./surfer.json').version.candidate") | |
| else | |
| VERSION=$(node -pe "require('./surfer.json').version.version") | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Check if patches got applied | |
| if: steps.git-check.outputs.files_changed == 'true' | |
| id: check-patches | |
| continue-on-error: true | |
| run: | | |
| echo "Checking if patches apply cleanly..." | |
| npm run import | |
| - name: Create pull request | |
| uses: peter-evans/create-pull-request@v7 | |
| if: steps.git-check.outputs.files_changed == 'true' | |
| env: | |
| GIT_TRACE: 1 | |
| GIT_CURL_VERBOSE: 1 | |
| with: | |
| token: ${{ secrets.DEPLOY_KEY }} | |
| commit-message: 'chore: Sync upstream to `Firefox ${{ steps.build-data.outputs.version }}`' | |
| branch: 'chore/upstream-sync' | |
| title: 'Sync upstream Firefox to version ${{ steps.build-data.outputs.version }}' | |
| body: | | |
| This PR syncs the upstream Firefox to version ${{ steps.build-data.outputs.version }}. | |
| * ${{ steps.check-patches.outcome == 'failure' && '⚠️ Some patches did not apply cleanly. Please review them carefully.' || '✅ All patches applied cleanly.' }} | |
| @${{ github.actor }} please review and merge this PR. | |
| base: dev | |
| git-token: ${{ secrets.DEPLOY_KEY }} | |
| delete-branch: true |