-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (58 loc) · 2.03 KB
/
Copy pathrelease.yml
File metadata and controls
68 lines (58 loc) · 2.03 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
name: build & publish
on:
workflow_dispatch:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
# Create (or reuse) the draft release ONCE, before the build matrix fans out,
# so the two OS runners don't both try to create it and end up with duplicate
# / split drafts. The build jobs then just upload assets into this draft.
create_release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Ensure draft release exists
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="${GITHUB_REF_NAME}"
gh release view "$tag" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1 \
|| gh release create "$tag" --repo "$GITHUB_REPOSITORY" --draft \
--title "WRONG $tag" --notes "Automated draft for $tag — assets uploaded by CI."
build:
needs: [create_release]
# Run after the gate on tag pushes; also run for manual workflow_dispatch
# (where the gate is skipped because there's no tag).
if: ${{ always() && (needs.create_release.result == 'success' || needs.create_release.result == 'skipped') }}
name: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
# Icons (build/icon*.png) are committed to the repo, so the build no
# longer shells out to rsvg-convert. Run `npm run icons` locally only when
# assets/icon.svg changes.
- name: Install dependencies
run: npm ci
- name: Build & publish (Linux)
if: runner.os == 'Linux'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run release:linux
- name: Build & publish (Windows)
if: runner.os == 'Windows'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run release:win