|
| 1 | +name: Build release |
| 2 | +permissions: |
| 3 | + id-token: write |
| 4 | + attestations: write |
| 5 | + contents: write |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + release-tag: |
| 11 | + required: true |
| 12 | + description: "Upstream release tag" |
| 13 | + type: string |
| 14 | + |
| 15 | + workflow_call: |
| 16 | + inputs: |
| 17 | + release-tag: |
| 18 | + required: true |
| 19 | + type: string |
| 20 | + |
| 21 | +jobs: |
| 22 | + prep: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + env: |
| 25 | + TAG: ${{ inputs.release-tag }} |
| 26 | + OUT_FILENAME: "uBlock0_${{ inputs.release-tag }}.crx" |
| 27 | + DIST_DIR: "./uBlock/dist/build/uBlock0.chromium" |
| 28 | + steps: |
| 29 | + - name: Checkout ublock-origin-crx |
| 30 | + uses: actions/checkout@v4 |
| 31 | + - name: Checkout uBlock |
| 32 | + uses: actions/checkout@v4 |
| 33 | + with: |
| 34 | + repository: gorhill/uBlock |
| 35 | + ref: ${{ inputs.release-tag }} |
| 36 | + path: uBlock |
| 37 | + - uses: pnpm/action-setup@v4 |
| 38 | + - run: pnpm i --frozen-lockfile |
| 39 | + - name: Build uBlock Origin sources |
| 40 | + run: cd uBlock && make chromium |
| 41 | + - name: Patch update URL |
| 42 | + run: node .github/patch-update-url.js "$DIST_DIR/manifest.json" |
| 43 | + - name: Build .crx |
| 44 | + env: |
| 45 | + CRX3_PRIVATE_KEY: ${{ secrets.CRX3_PRIVATE_KEY }} |
| 46 | + run: | |
| 47 | + echo "$CRX3_PRIVATE_KEY" \ |
| 48 | + | pnpm exec crx3 \ |
| 49 | + -p /dev/stdin \ |
| 50 | + -o "$OUT_FILENAME" \ |
| 51 | + "$DIST_DIR/" |
| 52 | + - name: Get extension ID |
| 53 | + id: crxid |
| 54 | + run: | |
| 55 | + echo -en "crx_id=" >> $GITHUB_OUTPUT |
| 56 | + pnpm exec crx3-info < "$OUT_FILENAME" \ |
| 57 | + | grep ^id \ |
| 58 | + | sed 's/.* //' >> $GITHUB_OUTPUT |
| 59 | + - name: Attest |
| 60 | + uses: actions/attest-build-provenance@v2 |
| 61 | + with: |
| 62 | + subject-path: ${{ env.OUT_FILENAME }} |
| 63 | + - name: Make release body |
| 64 | + run: ./.github/make-release-body.sh > release.md |
| 65 | + - name: Release |
| 66 | + uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981 |
| 67 | + id: release |
| 68 | + with: |
| 69 | + body_path: ./release.md |
| 70 | + draft: false |
| 71 | + prerelease: false |
| 72 | + files: ${{ env.OUT_FILENAME }} |
| 73 | + name: ${{ inputs.release-tag }} |
| 74 | + tag_name: ${{ inputs.release-tag }} |
| 75 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 76 | + - name: Update update.xml |
| 77 | + env: |
| 78 | + APP_ID: ${{ steps.crxid.outputs.crx_id }} |
| 79 | + DOWNLOAD_URL: ${{ fromJSON(steps.release.outputs.assets)[0].browser_download_url }} |
| 80 | + VERSION: ${{ inputs.release-tag }} |
| 81 | + run: | |
| 82 | + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 83 | + git config --local user.name "github-actions[bot]" |
| 84 | + ./.github/generate-updatexml.sh > update.xml |
| 85 | + git add update.xml |
| 86 | + git commit -m 'update.xml: refresh' |
| 87 | + git push |
0 commit comments