-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (142 loc) · 4.3 KB
/
Copy pathrelease-github.yml
File metadata and controls
173 lines (142 loc) · 4.3 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Release - GitHub
on:
workflow_dispatch:
inputs:
version:
description: "Semantic version to release (example: 2.3.0)"
required: true
type: string
permissions:
contents: write
jobs:
bump-version:
name: Check version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.meta.outputs.version }}
tag: ${{ steps.meta.outputs.tag }}
sha: ${{ steps.meta.outputs.sha }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Validate semantic version
run: |
version='${{ inputs.version }}'
if ! [[ "$version" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then
echo "Invalid semver: $version"
exit 1
fi
- name: Configure git author
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Export release metadata
id: meta
run: |
echo "version=${{ inputs.version }}" >> "$GITHUB_OUTPUT"
echo "tag=v${{ inputs.version }}" >> "$GITHUB_OUTPUT"
echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
build-chrome:
name: Build - Chrome
runs-on: ubuntu-latest
needs: bump-version
steps:
- uses: actions/checkout@v7
with:
ref: ${{ needs.bump-version.outputs.sha }}
- uses: pnpm/action-setup@v6
with:
version: 10
- uses: actions/setup-node@v7
with:
node-version: 24
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Zip extensions
run: pnpm zip
- name: Upload Chrome zip artifact
uses: actions/upload-artifact@v7
with:
name: chrome-zip
path: .output/*-chrome.zip
include-hidden-files: true
compression-level: 0
if-no-files-found: error
build-firefox:
name: Build - Firefox
runs-on: ubuntu-latest
needs: bump-version
steps:
- uses: actions/checkout@v7
with:
ref: ${{ needs.bump-version.outputs.sha }}
- uses: pnpm/action-setup@v6
with:
version: 10
- uses: actions/setup-node@v7
with:
node-version: 24
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Zip extensions
run: pnpm zip -b firefox
- name: Upload Firefox zip artifacts
uses: actions/upload-artifact@v7
with:
name: firefox-zips
path: |
.output/*-firefox.zip
.output/*-sources.zip
include-hidden-files: true
compression-level: 0
if-no-files-found: error
build-edge:
name: Build - Edge
runs-on: ubuntu-latest
needs: bump-version
steps:
- uses: actions/checkout@v7
with:
ref: ${{ needs.bump-version.outputs.sha }}
- uses: pnpm/action-setup@v6
with:
version: 10
- uses: actions/setup-node@v7
with:
node-version: 24
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Zip extensions
run: pnpm zip -b edge
- name: Upload Edge zip artifact
uses: actions/upload-artifact@v7
with:
name: edge-zip
path: .output/*-edge.zip
include-hidden-files: true
compression-level: 0
if-no-files-found: error
github-release:
name: Create GitHub release
runs-on: ubuntu-latest
needs: [bump-version, build-chrome, build-firefox, build-edge]
steps:
- name: Download all workflow artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
- name: Create GitHub release and upload assets
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ needs.bump-version.outputs.tag }}
name: ${{ needs.bump-version.outputs.tag }}
target_commitish: ${{ needs.bump-version.outputs.sha }}
generate_release_notes: true
prerelease: ${{ contains(needs.bump-version.outputs.version, '-') }}
files: |
artifacts/**/*.zip
fail_on_unmatched_files: true