-
Notifications
You must be signed in to change notification settings - Fork 5
95 lines (80 loc) · 3.48 KB
/
build-extension.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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
- run: bun install
- 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 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 }}
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
- 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_$VERSION.zip
DIST_FIREFOX_XPI: dist/artifacts/firefox/ao3-enhancements_firefox_$VERSION.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_$VERSION.xpi
DIST_FIREFOX_XPI: dist/artifacts/firefox/ao3-enhancements_firefox_$VERSION.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