-
Notifications
You must be signed in to change notification settings - Fork 3
210 lines (181 loc) · 7.03 KB
/
Copy pathrelease.yml
File metadata and controls
210 lines (181 loc) · 7.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
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
name: Build (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-linux-gnu
arch: x86_64-linux
- os: ubuntu-latest
target: aarch64-linux-gnu
arch: aarch64-linux
- os: macos-latest
target: aarch64-macos
arch: aarch64-macos
- os: macos-latest
target: x86_64-macos
arch: x86_64-macos
- os: windows-latest
target: x86_64-windows-gnu
arch: x86_64-windows
- os: windows-latest
target: aarch64-windows-gnu
arch: aarch64-windows
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Configure Git line endings
run: |
git config --global core.autocrlf false
git config --global core.eol lf
shell: bash
- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: '0.16.0'
- name: Build
run: |
VERSION="${GITHUB_REF_NAME#v}"
zig build -Doptimize=ReleaseSafe -Dtarget=${{ matrix.target }} -Dversion="$VERSION"
shell: bash
- name: Package versioned (Unix)
if: runner.os != 'Windows'
run: |
mkdir -p zvm-${{ github.ref_name }}-${{ matrix.arch }}
cp zig-out/bin/zvm zvm-${{ github.ref_name }}-${{ matrix.arch }}/
cp README.md LICENSE zvm-${{ github.ref_name }}-${{ matrix.arch }}/ 2>/dev/null || true
tar czvf zvm-${{ github.ref_name }}-${{ matrix.arch }}.tar.gz zvm-${{ github.ref_name }}-${{ matrix.arch }}
shell: bash
- name: Package versioned (Windows)
if: runner.os == 'Windows'
run: |
New-Item -ItemType Directory -Force -Path "zvm-${{ github.ref_name }}-${{ matrix.arch }}"
Copy-Item zig-out/bin/zvm.exe "zvm-${{ github.ref_name }}-${{ matrix.arch }}/" -ErrorAction SilentlyContinue
Copy-Item README.md "zvm-${{ github.ref_name }}-${{ matrix.arch }}/" -ErrorAction SilentlyContinue
Copy-Item LICENSE "zvm-${{ github.ref_name }}-${{ matrix.arch }}/" -ErrorAction SilentlyContinue
Compress-Archive -Path "zvm-${{ github.ref_name }}-${{ matrix.arch }}" -DestinationPath "zvm-${{ github.ref_name }}-${{ matrix.arch }}.zip" -Force
shell: pwsh
- name: Package latest (Unix)
if: runner.os != 'Windows'
run: |
mkdir -p zvm-${{ matrix.arch }}
cp zig-out/bin/zvm zvm-${{ matrix.arch }}/
cp README.md LICENSE zvm-${{ matrix.arch }}/ 2>/dev/null || true
tar czvf zvm-${{ matrix.arch }}.tar.gz zvm-${{ matrix.arch }}
shell: bash
- name: Package latest (Windows)
if: runner.os == 'Windows'
run: |
New-Item -ItemType Directory -Force -Path "zvm-${{ matrix.arch }}"
Copy-Item zig-out/bin/zvm.exe "zvm-${{ matrix.arch }}/" -ErrorAction SilentlyContinue
Copy-Item README.md "zvm-${{ matrix.arch }}/" -ErrorAction SilentlyContinue
Copy-Item LICENSE "zvm-${{ matrix.arch }}/" -ErrorAction SilentlyContinue
Compress-Archive -Path "zvm-${{ matrix.arch }}" -DestinationPath "zvm-${{ matrix.arch }}.zip" -Force
shell: pwsh
- name: Upload versioned artifacts
uses: actions/upload-artifact@v6
with:
name: zvm-versioned-${{ matrix.arch }}
path: |
zvm-${{ github.ref_name }}-*.tar.gz
zvm-${{ github.ref_name }}-*.zip
retention-days: 7
- name: Upload latest artifacts
uses: actions/upload-artifact@v6
with:
name: zvm-latest-${{ matrix.arch }}
path: |
zvm-x86_64-*.tar.gz
zvm-x86_64-*.zip
zvm-aarch64-*.tar.gz
zvm-aarch64-*.zip
retention-days: 7
create-release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Download versioned artifacts
uses: actions/download-artifact@v8
with:
path: artifacts/version
merge-multiple: true
pattern: zvm-versioned-*
- name: Download latest artifacts
uses: actions/download-artifact@v8
with:
path: artifacts/latest
merge-multiple: true
pattern: zvm-latest-*
- name: List artifacts
run: |
echo "=== Versioned ===" && ls -la artifacts/version/
echo "=== Latest ===" && ls -la artifacts/latest/
- name: Create Versioned Release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
draft: false
prerelease: false
files: |
artifacts/version/zvm-${{ github.ref_name }}-*.tar.gz
artifacts/version/zvm-${{ github.ref_name }}-*.zip
generate_release_notes: true
body: |
## ZVM ${{ github.ref_name }}
A fast, dependency-free Zig version manager.
### One-line Install
```bash
# macOS (Apple Silicon)
curl -L https://github.com/lispking/zvm/releases/latest/download/zvm-aarch64-macos.tar.gz | tar xz
# macOS (Intel)
curl -L https://github.com/lispking/zvm/releases/latest/download/zvm-x86_64-macos.tar.gz | tar xz
# Linux (x86_64)
curl -L https://github.com/lispking/zvm/releases/latest/download/zvm-x86_64-linux.tar.gz | tar xz
```
```bash
sudo mv zvm-*/zvm /usr/local/bin/
export PATH="${XDG_DATA_HOME:-$HOME/.local/share}/zvm/bin:$PATH"
```
### Available Builds
| Platform | Architecture | Stable URL |
|----------|--------------|------------|
| Linux | x86_64 | `zvm-x86_64-linux.tar.gz` |
| Linux | ARM64 | `zvm-aarch64-linux.tar.gz` |
| macOS | Intel | `zvm-x86_64-macos.tar.gz` |
| macOS | Apple Silicon | `zvm-aarch64-macos.tar.gz` |
| Windows | x86_64 | `zvm-x86_64-windows.zip` |
| Windows | ARM64 | `zvm-aarch64-windows.zip` |
All available at `https://github.com/lispking/zvm/releases/latest/download/<file>`
### Quick Start
```bash
zvm install master
zvm use master
zig version
```
- name: Update Latest Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release delete latest --yes 2>/dev/null || true
sleep 2
gh release create latest \
--title "Latest" \
--notes "Latest stable release (${{ github.ref_name }})." \
--target ${{ github.sha }} \
artifacts/latest/zvm-*.tar.gz artifacts/latest/zvm-*.zip