-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2964b3c
commit 3748731
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Build a release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-13, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Install Crystal | ||
uses: crystal-lang/install-crystal@v1 | ||
- name: Install dependencies | ||
run: shards install --production | ||
- 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 bin | ||
docker run --rm -it -v $(pwd):/workspace -w /workspace \ | ||
crystallang/crystal:latest-alpine \ | ||
crystal build --static --release --debug \ | ||
-o bin/moltiverse-${GITHUB_REF_SLUG}-linux-${ARCH} \ | ||
src/moltiverse.cr | ||
- if: startsWith(matrix.os, 'macos') | ||
name: Build binary (macOS) | ||
run: | | ||
mkdir bin | ||
crystal build --release --debug \ | ||
-o bin/moltiverse-${GITHUB_REF_SLUG}-osx-${ARCH} \ | ||
src/moltiverse.cr | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: bin-${{ matrix.os }} | ||
path: bin | ||
- 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: bin/* |