Skip to content

Commit 59ee5aa

Browse files
committed
chore(ci): + release workflow
closes gh-6 ref gh-3
1 parent 3fc112e commit 59ee5aa

File tree

2 files changed

+68
-3
lines changed

2 files changed

+68
-3
lines changed

.github/workflows/release.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- run: npm ci
14+
- run: npm run build
15+
- uses: actions/upload-artifact@v2
16+
with:
17+
path: build
18+
19+
publish:
20+
needs: build
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v3
24+
- run: npm ci
25+
- run: |
26+
npx web-ext sign \
27+
--source-dir src \
28+
--artifacts-dir build \
29+
--channel listed \
30+
--id $WEB_EXT_ID \
31+
--api-key $WEB_EXT_API_KEY \
32+
--api-secret $WEB_EXT_API_SECRET
33+
env:
34+
WEB_EXT_ID: ${{ vars.AMO_UUID }}
35+
WEB_EXT_API_KEY: ${{ secrets.AMO_API_KEY }}
36+
WEB_EXT_API_SECRET: ${{ secrets.AMO_API_SECRET }}
37+
- uses: actions/upload-artifact@v2
38+
with:
39+
path: build
40+
41+
release:
42+
needs: [build, publish]
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/download-artifact@v2
46+
with:
47+
path: build
48+
- id: major_version
49+
run: |
50+
echo major_version=$( \
51+
echo ${{ github.ref }} | cut -d'v' -f2 | cut -d'.' -f1 \
52+
) >> $GITHUB_OUTPUT
53+
- id: is_release_candidate
54+
run: |
55+
echo is_release_candidate=$( \
56+
echo ${{ github.ref }} | grep -c 'rc' \
57+
) >> $GITHUB_OUTPUT
58+
- name: Create release
59+
uses: softprops/action-gh-release@v1
60+
with:
61+
prerelease: >
62+
${{ steps.major_version.outputs.major_version == 0 ||
63+
steps.is_release_candidate.outputs.is_release_candidate == 1 }}
64+
generate_release_notes: true
65+
files: build/*

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"description": "Open URLs (video) in mpv, vlc, etc",
55
"main": "src/background.js",
66
"scripts": {
7-
"start:firefox": "web-ext run --source-dir ./src/ --firefox=firefox-dev",
8-
"start:chrome": "web-ext run --source-dir ./src/ --target=chromium",
9-
"build": "web-ext build --source-dir ./src/ --artifacts-dir ./build",
7+
"start:firefox": "web-ext run -s src --firefox=firefox-dev",
8+
"start:chrome": "web-ext run -s src --target=chromium",
9+
"build": "web-ext build -s src -a build",
1010
"test": "echo \"Error: no test specified\" && exit 1"
1111
},
1212
"repository": {

0 commit comments

Comments
 (0)