+26
-2
.github/workflows/package-extension.yml
+26
-2
.github/workflows/package-extension.yml
···
14
14
name: Build unsigned bundle
15
15
runs-on: ubuntu-latest
16
16
environment: "Default"
17
+
permissions:
18
+
contents: write
17
19
env:
18
20
AMO_JWT_ISSUER: ${{ secrets.AMO_JWT_ISSUER }}
19
21
AMO_JWT_SECRET: ${{ secrets.AMO_JWT_SECRET }}
···
40
42
path: web-ext-artifacts/**
41
43
42
44
- name: Sign using AMO (optional)
43
-
if: ${{ env.AMO_JWT_ISSUER != '' && env.AMO_JWT_SECRET != '' }}
44
45
env:
45
46
WEB_EXT_API_KEY: ${{ env.AMO_JWT_ISSUER }}
46
47
WEB_EXT_API_SECRET: ${{ env.AMO_JWT_SECRET }}
47
48
WEB_EXT_ID: frontpage-submitter@example.com
48
49
run: |
50
+
if [ -z "${WEB_EXT_API_KEY}" ] || [ -z "${WEB_EXT_API_SECRET}" ]; then
51
+
echo "AMO credentials not provided. Skipping signing step."
52
+
exit 0
53
+
fi
49
54
web-ext sign \
50
55
--channel=unlisted \
51
56
--source-dir ./extension \
52
57
--artifacts-dir ./web-ext-artifacts
53
58
54
59
- name: Upload signed artifact (optional)
55
-
if: ${{ env.AMO_JWT_ISSUER != '' && env.AMO_JWT_SECRET != '' }}
60
+
if: ${{ hashFiles('web-ext-artifacts/*.xpi') != '' }}
56
61
uses: actions/upload-artifact@v4
57
62
with:
58
63
name: frontpage-extension-signed
59
64
path: web-ext-artifacts/*.xpi
65
+
66
+
- name: Capture version info
67
+
run: |
68
+
VERSION=$(node -pe "require('./extension/manifest.json').version")
69
+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
70
+
echo "TAG=v${VERSION}-${GITHUB_RUN_ID}" >> $GITHUB_ENV
71
+
72
+
- name: Create GitHub release
73
+
uses: softprops/action-gh-release@v2
74
+
with:
75
+
tag_name: ${{ env.TAG }}
76
+
name: Frontpage Submitter ${{ env.VERSION }} (build ${{ github.run_number }})
77
+
draft: false
78
+
prerelease: true
79
+
generate_release_notes: false
80
+
files: |
81
+
web-ext-artifacts/*.zip
82
+
web-ext-artifacts/*.xpi
83
+
fail_on_unmatched_files: false
+1
README.md
+1
README.md
···
92
92
3. Download the artifacts:
93
93
- `frontpage-extension-unsigned` contains the ZIP that `web-ext build` generates.
94
94
- `frontpage-extension-signed` (only when secrets are present) contains the signed `.xpi` from AMO for self-hosting.
95
+
4. Each run also publishes a GitHub Release (tagged `v<version>-<run-id>`) that ships the same ZIP/XPI assets, so you can share a permanent download link.
95
96
96
97
These artifacts can be hosted directly for self-distribution as described in the [Mozilla documentation](https://extensionworkshop.com/documentation/publish/self-distribution/).