-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (42 loc) · 1.67 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
name: Release
on:
release:
types: ["published"]
jobs:
release:
runs-on: ${{ matrix.platform == 'linux' && 'ubuntu-latest' || matrix.platform == 'windows' && 'ubuntu-latest' || matrix.platform == 'macos' && 'macos-latest' }}
strategy:
matrix:
platform: [linux, windows, macos]
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
# Linux (for linux and windows we can use the default make commands to build the binary)
- name: Build binary (linux/windows)
if: matrix.platform == 'linux' || matrix.platform == 'windows'
run: make dist-${{ matrix.platform }}
# Macos (for macos we need to use cachix to install nix and devenv and then use devenv to build the binary)
- uses: cachix/install-nix-action@v26
if: matrix.platform == 'macos'
- uses: cachix/cachix-action@v14
if: matrix.platform == 'macos'
with:
name: devenv
- name: Install devenv.sh
if: matrix.platform == 'macos'
run: nix profile install nixpkgs#devenv
- name: Build binary (macos)
if: matrix.platform == 'macos'
run: devenv shell make dist-macos
# Finalize
- name: Test binary
run: dist/${{ matrix.platform }}/schwifty "DE89370400440532013000"
- name: Compress binary
run: tar -czvf schwifty-${{ matrix.platform }}.tar.gz -C dist/${{ matrix.platform }}/ schwifty
- uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./schwifty-${{ matrix.platform }}.tar.gz
asset_name: schwifty-${{ matrix.platform }}.tar.gz
asset_content_type: application/gzip