-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (77 loc) · 2.17 KB
/
release.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
env:
DIRECTORY: dist
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version. Example: 1.0.0'
required: true
type: string
jobs:
Version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 20
- uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
- name: install
run: npm ci || npm install
- name: Create tag
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/v${{ inputs.version }}>',
sha: context.sha
})
- if: ${{ inputs.version }}
name: Create release
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: >
await github.request(`POST /repos/${{ github.repository
}}/releases`, {
tag_name: "v${{ inputs.version }}",
generate_release_notes: true
});
Submit:
if: github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
command:
- chrome
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
- name: install
run: npm ci || npm install
- run: npm run prod --if-present
- name: Update extension’s meta
run: >-
npx dot-json@1 $DIRECTORY/manifest.json version ${{ inputs.version }}
- name: Submit
run: |
case ${{ matrix.command }} in
chrome)
cd $DIRECTORY && npx chrome-webstore-upload-cli@2 upload --auto-publish
;;
esac
env:
EXTENSION_ID: ${{ secrets.EXTENSION_ID }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}