Skip to content

.github/workflows/alpine_x86_64_release.yml #69

.github/workflows/alpine_x86_64_release.yml

.github/workflows/alpine_x86_64_release.yml #69

on:
push:
tags:
- "v*.*.*"
jobs:
build:
runs-on: ubuntu-latest
container:
image: crystallang/crystal:latest-alpine
steps:
- name: Cache shards
uses: actions/cache@v3
with:
path: ~/.cache/shards
key: ${{ runner.os }}-shards-${{ hashFiles('shard.yml') }}
restore-keys: ${{ runner.os }}-shards-
- name: Download source
uses: actions/checkout@v4
- name: sqlite
run: apk add --no-cache sqlite-static
- name: Install shards
run: shards check || shards install --without-development
- name: Check formatting
run: crystal tool format --check
- name: package information
run: |
echo "BINARY_NAME=bin/$(cat shard.yml |grep targets -A1|tail -n1 |sed 's#[ :]##g')" >> $GITHUB_ENV
echo "PKG_ARCH=x86_64" >> $GITHUB_ENV
echo "PLATFORM=unknown-linux-musl.tar.gz" >> $GITHUB_ENV
echo "BUILD_ARGS=--static --link-flags=\"-s -Wl,-z,relro,-z,now\"" >> $GITHUB_ENV
- name: set asset name
run: |
echo "ASSERT_NAME=${{env.BINARY_NAME}}-${{github.ref_name}}-${{env.PKG_ARCH}}-${{env.PLATFORM}}" >> $GITHUB_ENV
- name: release binary
id: release
run: |
echo "ASSERT_NAME=${{env.ASSERT_NAME}}" >> $GITHUB_OUTPUT
shards build --production --release --progress --no-debug -Dstrict_multi_assign -Dno_number_autocast ${{env.BUILD_ARGS}}
tar zcvf ${{env.ASSERT_NAME}} ${{env.BINARY_NAME}} LICENSE
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{steps.release.outputs.ASSERT_NAME}}