-
-
Notifications
You must be signed in to change notification settings - Fork 148
70 lines (57 loc) · 1.8 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
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
name: Build
on:
workflow_dispatch:
jobs:
build:
name: Build
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
- name: Checkout source code
uses: actions/checkout@v4
- name: Install dependencies
run: shards install
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v5
- name: Set architecture environment variable
run: |
if [ "$RUNNER_ARCH" == "X64" ]; then
echo "ARCH=x86_64" >> $GITHUB_ENV
elif [ "$RUNNER_ARCH" == "ARM64" ]; then
echo "ARCH=arm64" >> $GITHUB_ENV
else
echo "ARCH=unknown" >> $GITHUB_ENV
fi
- if: matrix.os == 'ubuntu-latest'
name: Build binary (Linux)
run: |
mkdir build
docker compose run --rm app crystal build src/mint.cr \
-o build/mint-${GITHUB_REF_SLUG}-linux-${ARCH} \
--static --no-debug --release
- if: startsWith(matrix.os, 'macos')
name: Build binary (macOS)
run: |
mkdir build
crystal build src/mint.cr \
-o build/mint-${GITHUB_REF_SLUG}-osx-${ARCH} \
--no-debug --release
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.os }}
path: build
- if: startsWith(github.ref, 'refs/tags/')
name: Upload to GitHub Releases
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: true
file_glob: true
file: build/*