-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
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
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 |