-
Notifications
You must be signed in to change notification settings - Fork 3
50 lines (50 loc) · 1.48 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
name: tagpr
on:
push:
branches: ["main"]
jobs:
tagpr:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tagpr.outputs.tag }}
permissions:
contents: write
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: increment chrome extnsion manifest.json version
run: |
CURRENT_VERSION=$(jq -r '.version' public/manifest.json)
NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{if (NF==1) {$1+=1} else {$NF+=1}; OFS="."; print $0}' | sed 's/ /./g')
jq --arg new_version $NEW_VERSION '.version = $new_version' public/manifest.json > public/manifest.json.tmp
mv public/manifest.json.tmp public/manifest.json
- uses: Songmu/tagpr@v1
id: tagpr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run job to upload artifact if git tagged
upload:
runs-on: ubuntu-latest
needs: tagpr
if: needs.tagpr.outputs.tag != ''
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
- name: Install dependencies
run: npm install
- name: Build
run: |
npm run build
zip -r dist.zip dist
- name: Upload artifact
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.tagpr.outputs.tag }}
files: |
dist.zip