Skip to content

Commit

Permalink
Created publish-to-amo-on-bump.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlui committed Oct 13, 2024
1 parent 11335d5 commit 1b0d558
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/publish-to-amo-on-bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish to AMO on version bump

on:
push:
branches: [main]
paths: [firefox/extension/manifest.json]

jobs:
check-version:
runs-on: ubuntu-latest
steps:

- name: Checkout adamlui/you.com-omnibox
uses: actions/checkout@v4
with:
token: ${{ secrets.REPO_SYNC_PAT }}
repository: adamlui/you.com-omnibox
path: adamlui/you-omnibox
fetch-depth: 2

- name: Check manifest for version bump
run: |
cd ${{ github.workspace }}/adamlui/you-omnibox
CURRENT_VER=$(cat firefox/extension/manifest.json | grep '"version"' | sed -E 's/.*"version": "(.*)".*/\1/')
PREV_VER=$(git show HEAD^:firefox/extension/manifest.json | grep '"version"' | sed -E 's/.*"version": "(.*)".*/\1/')
if [ "$(printf '%s\n' "$PREV_VER" "$CURRENT_VER" | sort -V | head -n 1)" != "$CURRENT_VER" ] ; then
echo "Extension updated from $PREV_VER to $CURRENT_VER"
echo "version_changed=true" >> $GITHUB_ENV
else echo "version_changed=false" >> $GITHUB_ENV ; fi
- name: Create zipball
if: env.version_changed == 'true'
run: |
cd ${{ github.workspace }}/adamlui/you-omnibox/firefox/extension
zip -r ../../extension.zip .
- name: Publish to AMO
if: env.version_changed == 'true'
uses: yayuyokitano/[email protected]
with:
api_key: ${{ secrets.AMO_ISSUER }}
api_secret: ${{ secrets.AMO_SECRET }}
guid: "[email protected]"
xpi_path: ${{ github.workspace }}/adamlui/you-omnibox/extension.zip

0 comments on commit 1b0d558

Please sign in to comment.