Skip to content

Commit 157f88d

Browse files
authored
Meta: Improve release workflow (refined-github#6114)
1 parent 9126d9e commit 157f88d

1 file changed

Lines changed: 24 additions & 35 deletions

File tree

.github/workflows/release.yml

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ on:
1111
jobs:
1212
Version:
1313
outputs:
14-
created: ${{ steps.daily-version.outputs.created }}
15-
version: ${{ steps.daily-version.outputs.version }}
14+
created: ${{ env.DAILY_VERSION_CREATED }}
1615
runs-on: ubuntu-latest
1716
steps:
1817
- uses: actions/checkout@v3
@@ -22,21 +21,25 @@ jobs:
2221
with:
2322
node-version-file: '.nvmrc'
2423
cache: npm
25-
- name: install
26-
run: npm ci || npm install
27-
- run: npm test
28-
- uses: fregante/daily-version-action@v1
24+
- run: npm ci
25+
- name: Test and build
26+
run: npm test
27+
- uses: fregante/daily-version-action@v2
2928
name: Create tag if necessary
30-
id: daily-version
31-
- if: steps.daily-version.outputs.created
29+
- name: Update extension’s meta
30+
run: npx dot-json@1 $DIRECTORY/manifest.json version $DAILY_VERSION
31+
- uses: actions/upload-artifact@v3
32+
with:
33+
name: built
34+
path: ${{ env.DIRECTORY }}
35+
- if: env.DAILY_VERSION_CREATED
3236
name: Create release
3337
env:
3438
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
working-directory: ${{ env.DIRECTORY }}
3540
run: |
36-
cd distribution
3741
zip -r refined-github-local-install.zip *
38-
gh release create "${{ steps.daily-version.outputs.version }}" --generate-notes refined-github-local-install.zip
39-
42+
gh release create "$DAILY_VERSION" --generate-notes refined-github-local-install.zip
4043
4144
Submit:
4245
needs: Version
@@ -49,32 +52,18 @@ jobs:
4952
- chrome
5053
runs-on: ubuntu-latest
5154
steps:
52-
- uses: actions/checkout@v3
53-
- uses: actions/setup-node@v3
54-
with:
55-
node-version-file: '.nvmrc'
56-
cache: npm
57-
- name: install
58-
run: npm ci || npm install
59-
- run: npm run build --if-present
60-
- name: Update extension’s meta
61-
run: >-
62-
npx dot-json@1 $DIRECTORY/manifest.json version ${{
63-
needs.Version.outputs.version }}
64-
- name: Submit
65-
run: |
66-
case ${{ matrix.command }} in
67-
chrome)
68-
cd $DIRECTORY && npx chrome-webstore-upload-cli@2 upload --auto-publish
69-
;;
70-
firefox)
71-
cd $DIRECTORY && npx web-ext-submit@7
72-
;;
73-
esac
55+
- uses: actions/download-artifact@v3
56+
- name: Submit to Mozilla
57+
if: matrix.command === 'firefox'
58+
run: cd artifacts/built && npx web-ext-submit@7
59+
env:
60+
WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_API_KEY }}
61+
WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_API_SECRET }}
62+
- name: Submit to Google
63+
if: matrix.command === 'chrome'
64+
run: cd artifacts/built && npx chrome-webstore-upload-cli@2 upload --auto-publish
7465
env:
7566
EXTENSION_ID: ${{ secrets.EXTENSION_ID }}
7667
CLIENT_ID: ${{ secrets.CLIENT_ID }}
7768
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
7869
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
79-
WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_API_KEY }}
80-
WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_API_SECRET }}

0 commit comments

Comments
 (0)