Release to addons.mozilla.org #66
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: Release to addons.mozilla.org | |
on: | |
# Run weekly every Friday | |
schedule: | |
- cron: "0 2 * * 6" | |
# Allow for manual releases if needed | |
workflow_dispatch: | |
jobs: | |
submit-amo: | |
name: Submit to addons.mozilla.org | |
runs-on: ubuntu-22.04 | |
if: github.repository == 'ruffle-rs/ruffle' | |
steps: | |
- name: Get latest release tag and date | |
id: release_info | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
# NOTE: The following line relies on the output of the `gh` command (when piped) looking like this: | |
# "Nightly 2024-04-20 Pre-release nightly-2024-04-20 2024-04-20T00:03:23Z" | |
# And sets the following outputs: tag = "nightly-2024-04-20", date = "2024_04_20" | |
# NOTE: The hyphens in the date are replaced with underscores. | |
run: gh release list -L1 | awk '{ print "tag="$4; gsub(/-/, "_"); print "date="$2; }' >> "$GITHUB_OUTPUT" | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ steps.release_info.outputs.tag }} | |
- name: Install node packages | |
working-directory: web | |
shell: bash -l {0} | |
run: npm ci | |
- name: Download latest release assets | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
RELEASE_TAG: ${{ steps.release_info.outputs.tag }} | |
RELEASE_DATE: ${{ steps.release_info.outputs.date }} | |
run: | | |
mkdir release_assets | |
gh release download --pattern "*.xpi" --pattern "*.zip" --dir release_assets $RELEASE_TAG | |
mv release_assets/ruffle-nightly-$RELEASE_DATE-reproducible-source.zip reproducible-source.zip | |
cd release_assets | |
unzip ruffle-nightly-$RELEASE_DATE-web-extension-firefox-unsigned.xpi | |
mv manifest.json ../web/packages/extension/assets/manifest.json | |
cd .. | |
mkdir web/packages/extension/dist | |
mv release_assets/ruffle-nightly-$RELEASE_DATE-web-extension-firefox-unsigned.xpi web/packages/extension/dist/firefox_unsigned.xpi | |
- name: Publish Firefox extension | |
id: sign-firefox | |
continue-on-error: true | |
env: | |
FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXTENSION_ID }} | |
MOZILLA_API_KEY: ${{ secrets.MOZILLA_API_KEY }} | |
MOZILLA_API_SECRET: ${{ secrets.MOZILLA_API_SECRET }} | |
SOURCE_TAG: ${{ steps.release_info.outputs.tag }} | |
working-directory: web/packages/extension | |
shell: bash -l {0} | |
run: npm run sign-firefox |