-
Notifications
You must be signed in to change notification settings - Fork 1
44 lines (41 loc) · 1.74 KB
/
build.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
# Builds a `ziglint` binary and posts it to GH
on:
release:
types: [created]
push:
branches: [main]
name: Build/Publish Binary
jobs:
build_publish:
strategy:
matrix:
cpu: [x86_64, aarch64]
os: [linux, macos, windows]
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v2
- name: Install nightly Zig
uses: goto-bus-stop/setup-zig@v1
with:
version: master
- name: Set compile options (release)
if: ${{ github.event_name == 'release' }}
run: echo "OPTIONS=-Dno-git-hash=true" >> "$GITHUB_ENV"
- name: Compile
run: zig build -Dtarget=${{ matrix.cpu }}-${{ matrix.os }} -Doptimize=ReleaseFast ${{ env.OPTIONS }}
- name: Set binary suffix (Windows)
if: ${{ matrix.os == 'windows' }}
run: echo "SUFFIX=.exe" >> "$GITHUB_ENV"
- name: Upload (existing release)
if: ${{ github.event_name == 'release'}}
run: |
mv zig-out/bin/ziglint${{ env.SUFFIX }} zig-out/bin/ziglint-${{ matrix.os }}-${{ matrix.cpu }}${{ env.SUFFIX }}
gh release upload ${{ github.event.release.tag_name }} zig-out/bin/*${{ env.SUFFIX }}
- name: Upload (HEAD)
if: ${{ github.event_name == 'push' }}
run: |
mv zig-out/bin/ziglint${{ env.SUFFIX }} zig-out/bin/ziglint-${{ matrix.os }}-${{ matrix.cpu }}${{ env.SUFFIX }}
gh release upload latest zig-out/bin/*${{ env.SUFFIX }} --clobber
gh release edit --target ${{ github.sha }} latest