Fix workflow #54
Workflow file for this run
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
name: Build extension | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+*' | |
jobs: | |
pre: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.full }} | |
is_prerelease: ${{ steps.version.outputs.prerelease && 'true' || 'false' }} | |
dist_source_zip: dist/artifacts/source/ao3-enhancements_source_${{ steps.version.outputs.full }}.zip | |
dist_chrome_zip: dist/artifacts/chrome/ao3-enhancements_chrome_${{ steps.version.outputs.full }}.zip | |
dist_firefox_zip: dist/artifacts/firefox/ao3-enhancements_firefox_${{ steps.version.outputs.full }}.zip | |
dist_firefox_xpi: dist/artifacts/firefox/ao3-enhancements_firefox_${{ steps.version.outputs.full }}.xpi | |
steps: | |
- name: Parse version from tag | |
id: version | |
uses: release-kit/semver@v2 | |
build: | |
runs-on: ubuntu-latest | |
needs: pre | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v2 | |
- 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 }} | |
run: gh release create --draft --generate-notes --prerelease=${{ needs.pre.outputs.is_prerelease }} v${{ needs.pre.outputs.version }} ${{ needs.pre.outputs.dist_source_zip }} ${{ needs.pre.outputs.dist_chrome_zip }} | |
- name: Upload dist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
firefox: | |
runs-on: ubuntu-latest | |
needs: [pre, build] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v2 | |
- uses: actions/download-artifact@v4 | |
- name: Submit to AMO | |
env: | |
API_KEY: ${{ secrets.AMO_API_KEY }} | |
API_SECRET: ${{ secrets.AMO_API_SECRET }} | |
CHANNEL: ${{ needs.pre.outputs.is_prerelease == 'true' && 'unlisted' || 'listed' }} | |
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=${{ needs.pre.outputs.dist_source_zip }} | |
- name: Rename .xpi to proper version if applicable | |
run: | | |
if ls dist/artifacts/firefox/*.xpi 1> /dev/null 2>&1; then | |
mv dist/artifacts/firefox/*.xpi ${{ needs.pre.outputs.dist_firefox_xpi }} | |
rm ${{ needs.pre.outputs.dist_firefox_zip }} | |
fi | |
- name: Upload firefox artifact | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh release upload v${{ needs.pre.outputs.version }} ${{ needs.pre.outputs.dist_firefox_xpi }} || gh release upload v${{ needs.pre.outputs.version }} ${{ needs.pre.outputs.dist_firefox_zip }} | |
chrome: | |
runs-on: ubuntu-latest | |
needs: [pre, build] | |
if: ${{ needs.pre.outputs.is_prerelease == 'false' }} | |
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 }} | |
run: bun x chrome-webstore-upload-cli --source={{ needs.pre.outputs.dist_chrome_zip }} |