-
-
Notifications
You must be signed in to change notification settings - Fork 7
97 lines (80 loc) · 3.11 KB
/
Copy pathrelease.yml
File metadata and controls
97 lines (80 loc) · 3.11 KB
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
96
97
name: Release Workflow
on:
push:
branches: [master]
permissions:
contents: write
pull-requests: write
jobs:
check-version:
runs-on: ubuntu-latest
outputs:
hasNextVersion: ${{ steps.version.outputs.hasNextVersion }}
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Get next version
uses: thenativeweb/get-next-version@2.7.3
id: version
build-and-release:
runs-on: ubuntu-latest
needs: check-version
if: needs.check-version.outputs.hasNextVersion == 'true'
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build
- name: Update version files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
NEW_VERSION="${{ needs.check-version.outputs.version }}"
if [ "$CURRENT_VERSION" != "$NEW_VERSION" ]; then
npm version $NEW_VERSION --no-git-tag-version
npm run version
fi
- name: Build plugin
run: npm run build
- name: Verify build artifacts
run: |
test -f dist/main.js
test -f dist/manifest.json
test -f dist/styles.css
- name: Commit and push version changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
NEW_VERSION="${{ needs.check-version.outputs.version }}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if ! git diff --quiet || ! git diff --cached --quiet; then
git add package.json manifest.json versions.json
git commit -m "chore: bump version to $NEW_VERSION [skip ci]"
git push origin master
fi
- name: Create and push tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
NEW_VERSION="${{ needs.check-version.outputs.version }}"
git tag $NEW_VERSION
git push origin $NEW_VERSION
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
NEW_VERSION="${{ needs.check-version.outputs.version }}"
gh release create $NEW_VERSION \
--title "$NEW_VERSION" \
--notes "Automated release $NEW_VERSION" \
--latest \
dist/main.js \
dist/manifest.json \
dist/styles.css