Skip to content

Commit 5cdd332

Browse files
authored
Create release.yml
1 parent 45c85dd commit 5cdd332

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/release.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
draft:
6+
type: boolean
7+
concurrency: ${{ github.workflow }}
8+
jobs:
9+
tagver:
10+
outputs:
11+
tagver: ${{ steps.tagver.outputs.tagver }}
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- id: tagver
16+
run: |
17+
tagver=$(grep -Po 'TAGVER=\S+' script | head -n1 | cut -d'=' -f2)
18+
echo "tagver=$tagver" >> "$GITHUB_OUTPUT"
19+
create-release:
20+
needs: tagver
21+
permissions:
22+
contents: write
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: bjia56/setup-cosmocc@v0.0.3
27+
# This fakes the from-source build outputs. Building from Zig source takes way too long.
28+
- env:
29+
TAGVER: ${{ needs.tagver.outputs.tagver }}
30+
run: |
31+
wget "https://ziglang.org/download/$TAGVER/zig-windows-x86_64-$TAGVER.zip"
32+
wget "https://ziglang.org/download/$TAGVER/zig-windows-aarch64-$TAGVER.zip"
33+
wget "https://ziglang.org/download/$TAGVER/zig-macos-aarch64-$TAGVER.tar.xz"
34+
wget "https://ziglang.org/download/$TAGVER/zig-macos-x86_64-$TAGVER.tar.xz"
35+
wget "https://ziglang.org/download/$TAGVER/zig-linux-x86_64-$TAGVER.tar.xz"
36+
wget "https://ziglang.org/download/$TAGVER/zig-linux-aarch64-$TAGVER.tar.xz"
37+
wget "https://ziglang.org/download/$TAGVER/zig-freebsd-x86_64-$TAGVER.tar.xz"
38+
39+
unzip -q "zig-windows-x86_64-$TAGVER.zip"
40+
unzip -q "zig-windows-aarch64-$TAGVER.zip"
41+
tar xf "zig-macos-aarch64-$TAGVER.tar.xz"
42+
tar xf "zig-macos-x86_64-$TAGVER.tar.xz"
43+
tar xf "zig-linux-x86_64-$TAGVER.tar.xz"
44+
tar xf "zig-linux-aarch64-$TAGVER.tar.xz"
45+
tar xf "zig-freebsd-x86_64-$TAGVER.tar.xz"
46+
47+
rm "zig-windows-x86_64-$TAGVER.zip"
48+
rm "zig-windows-aarch64-$TAGVER.zip"
49+
rm "zig-macos-aarch64-$TAGVER.tar.xz"
50+
rm "zig-macos-x86_64-$TAGVER.tar.xz"
51+
rm "zig-linux-x86_64-$TAGVER.tar.xz"
52+
rm "zig-linux-aarch64-$TAGVER.tar.xz"
53+
rm "zig-freebsd-x86_64-$TAGVER.tar.xz"
54+
- env:
55+
TAGVER: ${{ needs.tagver.outputs.tagver }}
56+
run: ./build-zig-ape
57+
- env:
58+
TAGVER: ${{ needs.tagver.outputs.tagver }}
59+
run: 7z a zig-ape-$TAGVER.zip zig-ape-$TAGVER/
60+
- env:
61+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
TAGVER: ${{ needs.tagver.outputs.tagver }}
63+
run: |
64+
gh release create "$TAGVER" \
65+
${{ (inputs.draft && '--draft') || '' }} \
66+
--title "$TAGVER" \
67+
--notes "https://ziglang.org/download/#release-$TAGVER" \
68+
"zig-ape-$TAGVER.zip"

0 commit comments

Comments
 (0)