feat: Allow source code submission and metadata changes #138
Workflow file for this run
This file contains 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: "Build" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build: | |
name: "Build" | |
runs-on: ubuntu-latest | |
outputs: | |
name: ${{ steps.web-ext-build.outputs.name }} | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: "Setup node" | |
uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
cache: npm | |
- name: "npm ci" | |
run: npm ci | |
- name: "Run Linters" | |
run: npm run lint | |
- name: "Bump version" | |
run: | | |
export VERSION="1.$((10#${GITHUB_RUN_ID:0:4})).$((10#${GITHUB_RUN_ID:4})).${GITHUB_RUN_ATTEMPT}" | |
jq ".version = \"$VERSION\"" test/extension/manifest.json > manifest.json~ | |
mv manifest.json~ test/extension/manifest.json | |
git diff test/extension | |
- name: "Self-test: lint" | |
id: web-ext-lint | |
uses: "./" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
cmd: lint | |
source: test/extension | |
channel: unlisted | |
- name: "Self-test: build" | |
id: web-ext-build | |
uses: "./" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
cmd: build | |
source: test/extension | |
channel: unlisted | |
- name: "Upload Unsigned" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: unsigned.xpi | |
path: ${{ steps.web-ext-build.outputs.target }} | |
if-no-files-found: error | |
amo: | |
name: "Self-test: AMO release" | |
runs-on: ubuntu-latest | |
needs: build | |
env: | |
HAS_SIGN_KEY: ${{ secrets.AMO_SIGN_KEY != '' && secrets.AMO_SIGN_SECRET != '' }} | |
steps: | |
- name: "Checkout" | |
if: env.HAS_SIGN_KEY | |
uses: actions/checkout@v4 | |
- name: "Setup node" | |
if: env.HAS_SIGN_KEY | |
uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
cache: npm | |
- name: "npm ci" | |
if: env.HAS_SIGN_KEY | |
run: npm ci | |
- name: "Get release build" | |
if: env.HAS_SIGN_KEY | |
uses: actions/download-artifact@v4 | |
with: | |
name: unsigned.xpi | |
path: web-ext-artifacts | |
- name: "Collect sources" | |
if: env.HAS_SIGN_KEY | |
run: git archive --format=zip --output=sources.zip HEAD | |
- name: "Collect metadata" | |
if: env.HAS_SIGN_KEY | |
id: metadata | |
run: echo "json=$(jq -c . < test/amo_metadata.json)" >> $GITHUB_OUTPUT | |
- name: "Release" | |
if: env.HAS_SIGN_KEY | |
id: web-ext-sign-amo | |
uses: "./" | |
with: | |
cmd: sign | |
source: web-ext-artifacts/${{ needs.build.outputs.name }} | |
sourceCode: sources.zip | |
channel: unlisted | |
metaDataJson: ${{ steps.metadata.outputs.json }} | |
approvalNotes: "Please find more information at https://github.com/kewisch/action-web-ext" | |
releaseNotes: "Triggered by ${{ github.event_name }} for ${{ github.sha }}" | |
license: MPL-2.0 | |
apiKey: ${{ secrets.AMO_SIGN_KEY }} | |
apiSecret: ${{ secrets.AMO_SIGN_SECRET }} | |
- name: "Upload AMO signed" | |
if: env.HAS_SIGN_KEY | |
uses: actions/upload-artifact@v4 | |
with: | |
name: amo-signed.xpi | |
path: ${{ steps.web-ext-sign-amo.outputs.target }} | |
if-no-files-found: error | |
atn: | |
name: "Self-test: ATN release" | |
runs-on: ubuntu-latest | |
needs: build | |
env: | |
HAS_SIGN_KEY: ${{ secrets.ATN_SIGN_KEY != '' && secrets.ATN_SIGN_SECRET != '' }} | |
steps: | |
- name: "Checkout" | |
if: env.HAS_SIGN_KEY | |
uses: actions/checkout@v4 | |
- name: "Setup node" | |
if: env.HAS_SIGN_KEY | |
uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
cache: npm | |
- name: "npm ci" | |
if: env.HAS_SIGN_KEY | |
run: npm ci | |
- name: "Get release build" | |
if: env.HAS_SIGN_KEY | |
uses: actions/download-artifact@v4 | |
with: | |
name: unsigned.xpi | |
path: web-ext-artifacts | |
- name: "Self-test: ATN release" | |
if: env.HAS_SIGN_KEY | |
id: web-ext-sign-atn | |
uses: "./" | |
with: | |
cmd: sign | |
source: web-ext-artifacts/${{ needs.build.outputs.name }} | |
channel: unlisted | |
apiUrlPrefix: "https://addons.thunderbird.net/api/v4" | |
apiKey: ${{ secrets.ATN_SIGN_KEY }} | |
apiSecret: ${{ secrets.ATN_SIGN_SECRET }} |