-
Notifications
You must be signed in to change notification settings - Fork 4
93 lines (80 loc) · 2.66 KB
/
release.yml
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
name: Release
on:
push:
tags:
- v*.*.*
workflow_dispatch:
jobs:
upload-binaries:
name: Upload Binaries
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF_NAME:1}" >> $GITHUB_ENV
- name: Install Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.13.0
- name: Print meta
run: |
echo $RELEASE_VERSION
zig version
zig env
# Build binaries for target queries in `build.zig`, contents
# will be saved in `zig-out`
- name: Build release binaries
run: |
rm -rf zig-out # sanity
zig build release --summary all
# Rename binary folders with name-version prefix, and copy
# other assets into individual release folders.
- name: Collect assets
shell: bash
run: |
version_prefix="fex-${{ env.RELEASE_VERSION }}-"
for build_path in "zig-out"/*; do
echo "Collecting $build_path"
# Rename folder
new_folder_name=$version_prefix$(basename $build_path)
new_build_path="zig-out/$new_folder_name"
mv "$build_path" "$new_build_path"
# Copy assets into release folders
cp {LICENSE,README.md} "$new_build_path"
cp -r shell/. "$new_build_path"
done
# Create tar.gz of release folders, and calculate their
# checksums. Output is stored in `release`.
- name: Prepare artifacts
shell: bash
run: |
mkdir -p release && cd release
for asset in "../zig-out"/*; do
echo "Preparing $asset"
asset_name=$(basename $asset)
tar_name=${asset_name}.tar.gz
tar -C ../zig-out -czvf $tar_name $asset_name
shasum -a 512 $tar_name > ${tar_name}.sha512
done
# Creates a new release and uploads artifacts to it.
- name: Upload for release
uses: svenstaro/upload-release-action@v2
with:
file: release/*
file_glob: true
overwrite: true
tag: ${{ github.ref }}
release_name: 'Release v${{ env.RELEASE_VERSION }}'
repo_token: ${{ secrets.RELEASE_TOKEN }}
draft: true
# Upload artifacts to GHA for inspection incase something
# goes wrong.
- name: Upload for inspection
uses: actions/upload-artifact@v4
with:
name: release-artifact
path: release/
retention-days: 3
overwrite: true
if-no-files-found: error