Skip to content

0.5.0-beta.14

0.5.0-beta.14 #46

Workflow file for this run

name: Build extension
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- name: Parse semver string
id: semver
uses: booxmedialtd/ws-action-parse-semver@v1.4.7
with:
input_string: ${{ github.ref }}
version_extractor_regex: '\/v(.*)$'
- run: bun install
- run: bun run build
- run: bun run dist
- run: bun run dist:lint
- name: Create draft release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.semver.outputs.fullversion }}
PRERELEASE: ${{ steps.semver.outputs.prerelease && 'true' || 'false' }}
DIST_SOURCE: dist/artifacts/source/ao3-enhancements_source_${{ steps.semver.outputs.fullversion }}.zip
DIST_CHROME: dist/artifacts/chrome/ao3-enhancements_chrome_${{ steps.semver.outputs.fullversion }}.zip
run: gh release create --draft --generate-notes --prerelease=$PRERELEASE v$VERSION $DIST_SOURCE $DIST_CHROME
- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
firefox:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- name: Parse semver string
id: semver
uses: booxmedialtd/ws-action-parse-semver@v1.4.7
with:
input_string: ${{ github.ref }}
version_extractor_regex: '\/v(.*)$'
- uses: actions/download-artifact@v4
- name: Submit to AMO
env:
API_KEY: ${{ secrets.AMO_API_KEY }}
API_SECRET: ${{ secrets.AMO_API_SECRET }}
CHANNEL: ${{ steps.semver.outputs.prerelease && 'unlisted' || 'listed' }}
VERSION: ${{ steps.semver.outputs.fullversion }}
DIST_SOURCE: dist/artifacts/source/ao3-enhancements_source_${{ steps.semver.outputs.fullversion }}.zip
run: bun x web-ext sign --config=scripts/web-ext.firefox.cjs --channel=$CHANNEL --api-key=$API_KEY --api-secret=$API_SECRET --upload-source-code=$DIST_SOURCE
- name: Rename .xpi to proper version if applicable
env:
VERSION: ${{ steps.semver.outputs.fullversion }}
DIST_FIREFOX_ZIP: dist/artifacts/firefox/ao3-enhancements_firefox_${{ steps.semver.outputs.fullversion }}.zip
DIST_FIREFOX_XPI: dist/artifacts/firefox/ao3-enhancements_firefox_${{ steps.semver.outputs.fullversion }}.xpi
run: |
if ls dist/artifacts/firefox/*.xpi 1> /dev/null 2>&1; then
mv dist/artifacts/firefox/*.xpi $DIST_FIREFOX_XPI
rm $DIST_FIREFOX_ZIP
fi
- name: Upload firefox artifact
env:
VERSION: ${{ steps.semver.outputs.fullversion }}
DIST_FIREFOX_ZIP: dist/artifacts/firefox/ao3-enhancements_firefox_${{ steps.semver.outputs.fullversion }}.xpi
DIST_FIREFOX_XPI: dist/artifacts/firefox/ao3-enhancements_firefox_${{ steps.semver.outputs.fullversion }}.xpi
run: gh release upload v$VERSION $DIST_FIREFOX_XPI || gh release upload v$VERSION $DIST_FIREFOX_ZIP
# chrome:
# runs-on: ubuntu-latest
# needs: build
# steps:
# - uses: oven-sh/setup-bun@v2
# - uses: actions/download-artifact@v4
# - name: Submit to Chrome Web Store
# env:
# EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }}
# CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
# CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
# REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
# VERSION: ${{ steps.semver.outputs.fullversion }}
# DIST_CHROME: dist/artifacts/chrome/ao3-enhancements_chrome_${{ steps.semver.outputs.fullversion }}.zip
# run: bun x web-ext chrome-webstore-upload-cli --source=$DIST_SOURCE