Skip to content

Publish

Publish #2

Workflow file for this run

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
---
name: Publish
on:
release:
types: [published]
permissions:
contents: write
jobs:
release:
name: "Release"
runs-on: ubuntu-latest
environment: ${{ github.event.release.prerelease && 'beta' || 'release' }}
steps:
- name: "All: Checkout"
uses: actions/checkout@v4
- name: "All: npm ci"
run: npm ci
- name: "All: npm run lint"
run: npm run lint
- name: "Beta: Add update_url to manifest"
if: ${{ github.event.release.prerelease }}
run: |
jq '.browser_specific_settings.gecko.update_url = "https://kewisch.github.io/gdata-provider/update.json"' \
src/manifest.json > src/manifest.json~
diff -u src/manifest.json src/manifest.json~
mv src/manifest.json~ src/manifest.json
- name: "All: Adjust OAuth keys"
env:
KEYS: ${{ secrets.OAUTH_KEYS }}
FILENAME: ${{ github.event.release.prerelease && 'src/background/session.js' || 'src/legacy/modules/gdataSession.sys.mjs' }}
run: |
if [ -z "$KEYS" ]
then
exit 0
fi
awk -v keys "$KEYS" '
/\/\* BEGIN OAUTH \*\// {print; inside=1; print keys"; next}
/\/\* END OAUTH \*\// {inside=0}
!inside
' $FILENAME > $FILENAME~
diff -u $FILENAME $FILENAME~
mv $FILENAME~ $FILENAME
- name: "All: Build"
run: npm run build
# - name: "Release: web-ext sign"
# if: ${{ ! github.event.release.prerelease }}
# uses: kewisch/action-web-ext@v1
# with:
# cmd: sign
# source: dist/gdata-provider.xpi
# channel: listed
# apiUrlPrefix: "https://addons.thunderbird.net/api/v4"
# apiKey: ${{ secrets.AMO_SIGN_KEY }}
# apiSecret: ${{ secrets.AMO_SIGN_SECRET }}
- name: "Beta: Checkout gh_pages"
if: ${{ github.event.release.prerelease }}
uses: actions/checkout@v4
with:
branch: gh_pages
path: gh_pages
fetch-depth: 0
- name: "Beta: Add new release to updates.json"
if: ${{ github.event.release.prerelease }}
working-directory: gh_pages
env:
TAG_NAME: ${{ github.event.release.tag_name }}
run: |
jq --arg tag_name $TAG_NAME -s '
.[0].addons[.[1].browser_specific_settings.gecko.id].updates =
[{
version: .[1].version,
update_link: "https://github.com/kewisch/gdata-provider/releases/download/\($tag_name)/gdata-provider.xpi",
applictions: {
gecko: {
strict_min_version: .[1].browser_specific_settings.gecko.strict_min_version,
strict_max_version: .[1].browser_specific_settings.gecko.strict_max_version
}
}
}] + .[0].addons[.[1].browser_specific_settings.gecko.id].updates | .[0]
' update.json ../src/manifest.json > update.json~
diff -u update.json update.json~
mv update.json~ update.json
- name: "All: Attach release assets"
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload ${{ github.event.release.tag_name }} \
dist/gdata-provider.xpi
- name: "Beta: Push back gh_pages"
if: ${{ github.event.release.prerelease }}
working-directory: gh_pages
env:
TAG_NAME: ${{ github.event.release.tag_name }}
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git diff
#git commit -a -m "Release $TAG_NAME"