-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (85 loc) · 2.48 KB
/
release.yml
File metadata and controls
103 lines (85 loc) · 2.48 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
name: Auto Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.artifact }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
artifact: codimd-cli-linux-x64
- os: ubuntu-24.04-arm
artifact: codimd-cli-linux-arm64
- os: macos-latest
artifact: codimd-cli-darwin-arm64
- os: windows-latest
artifact: codimd-cli-windows-x64.exe
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install Zig (OpenTUI native build)
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.13.0
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build standalone binary
run: bun build ./src/cli.ts --compile --outfile dist/${{ matrix.artifact }}
- name: Verify binary runs
shell: bash
run: dist/${{ matrix.artifact }} --help
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: dist/${{ matrix.artifact }}
create-release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Determine prerelease
id: meta
run: |
TAG="${GITHUB_REF_NAME#v}"
if echo "$TAG" | grep -Eq '(^|[.-])(alpha|beta|rc|pre)[.-]|^.*-pre\.'; then
echo "prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "prerelease=false" >> "$GITHUB_OUTPUT"
fi
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
ARGS=(
"${{ github.ref_name }}"
--title "Release ${{ github.ref_name }}"
--generate-notes
)
if [ "${{ steps.meta.outputs.prerelease }}" = "true" ]; then
ARGS+=(--prerelease)
fi
shopt -s nullglob
FILES=(artifacts/*)
if [ "${#FILES[@]}" -gt 0 ]; then
ARGS+=("${FILES[@]}")
fi
gh release create "${ARGS[@]}"