|
| 1 | +name: Sync Upstream Firefox Releases |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '59 4 * * 2' |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + release_candidate: |
| 9 | + description: 'Set to true to sync release candidates' |
| 10 | + required: false |
| 11 | + default: 'false' |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: write |
| 15 | + |
| 16 | +jobs: |
| 17 | + check_candidates: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Check out repository |
| 22 | + uses: actions/checkout@v3 |
| 23 | + |
| 24 | + - name: Setup Node.js |
| 25 | + uses: actions/setup-node@v4 |
| 26 | + with: |
| 27 | + node-version-file: '.nvmrc' |
| 28 | + |
| 29 | + - name: Install dependencies |
| 30 | + run: npm ci |
| 31 | + |
| 32 | + - name: Sync Upstream Releases |
| 33 | + run: | |
| 34 | + if [ "${{ github.event.inputs.release_candidate }}" = "true" ]; then |
| 35 | + npm run sync:rc |
| 36 | + else |
| 37 | + npm run sync |
| 38 | + fi |
| 39 | +
|
| 40 | + - name: Check if any files changed |
| 41 | + id: git-check |
| 42 | + run: | |
| 43 | + if [ -n "$(git status --porcelain)" ]; then |
| 44 | + echo "files_changed=true" >> $GITHUB_OUTPUT |
| 45 | + else |
| 46 | + echo "files_changed=false" >> $GITHUB_OUTPUT |
| 47 | + fi |
| 48 | +
|
| 49 | + - name: Get Firefox Version |
| 50 | + id: build-data |
| 51 | + if: steps.git-check.outputs.files_changed == 'true' |
| 52 | + run: | |
| 53 | + if [ "${{ github.event.inputs.release_candidate }}" = "true" ]; then |
| 54 | + VERSION=$(node -pe "require('./surfer.json').version.candidate") |
| 55 | + else |
| 56 | + VERSION=$(node -pe "require('./surfer.json').version.version") |
| 57 | + fi |
| 58 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 59 | +
|
| 60 | + - name: Check if pathes got applied |
| 61 | + if: steps.git-check.outputs.files_changed == 'true' |
| 62 | + id: check-patches |
| 63 | + continue-on-error: true |
| 64 | + run: | |
| 65 | + echo "Checking if patches apply cleanly..." |
| 66 | + npm run import |
| 67 | +
|
| 68 | + - name: Create pull request |
| 69 | + uses: peter-evans/create-pull-request@v7 |
| 70 | + if: steps.git-check.outputs.files_changed == 'true' |
| 71 | + env: |
| 72 | + GIT_TRACE: 1 |
| 73 | + GIT_CURL_VERBOSE: 1 |
| 74 | + with: |
| 75 | + token: ${{ secrets.DEPLOY_KEY }} |
| 76 | + commit-message: 'chore: Sync upstream to `Firefox ${{ steps.build-data.outputs.version }}`' |
| 77 | + branch: 'chore/sync-upstream-${{ steps.build-data.outputs.version }}' |
| 78 | + title: 'Sync upstream Firefox to version ${{ steps.build-data.outputs.version }}' |
| 79 | + body: | |
| 80 | + This PR syncs the upstream Firefox to version ${{ steps.build-data.outputs.version }}. |
| 81 | +
|
| 82 | + * ${{ steps.check-patches.outcome == 'failure' && '⚠️ Some patches did not apply cleanly. Please review them carefully.' || '✅ All patches applied cleanly.' }} |
| 83 | +
|
| 84 | + @${{ github.actor }} please review and merge this PR. |
| 85 | + base: dev |
| 86 | + git-token: ${{ secrets.DEPLOY_KEY }} |
| 87 | + delete-branch: true |
0 commit comments