From 1b0d55827c13a552ce1e4b5511ee49fbb103e89b Mon Sep 17 00:00:00 2001 From: "adamlui@protonmail.com" Date: Sun, 13 Oct 2024 08:27:51 -0700 Subject: [PATCH] Created publish-to-amo-on-bump.yml --- .github/workflows/publish-to-amo-on-bump.yml | 44 ++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/publish-to-amo-on-bump.yml diff --git a/.github/workflows/publish-to-amo-on-bump.yml b/.github/workflows/publish-to-amo-on-bump.yml new file mode 100644 index 0000000..442a1b9 --- /dev/null +++ b/.github/workflows/publish-to-amo-on-bump.yml @@ -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/firefox-addon@v0.0.6-alpha + with: + api_key: ${{ secrets.AMO_ISSUER }} + api_secret: ${{ secrets.AMO_SECRET }} + guid: "you.com.omnibox@adamlui.com" + xpi_path: ${{ github.workspace }}/adamlui/you-omnibox/extension.zip