.github/workflows/macos_release.yml #12
Workflow file for this run
This file contains hidden or 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
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| jobs: | |
| build: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Cache shards | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/shards | |
| key: ${{ runner.os }}-shards-${{ hashFiles('shard.yml') }} | |
| restore-keys: ${{ runner.os }}-shards- | |
| - name: Download source | |
| uses: actions/checkout@v4 | |
| - name: Install Crystal | |
| uses: crystal-lang/install-crystal@v1 | |
| - name: Check formatting | |
| run: crystal tool format --check | |
| - name: Install shards | |
| run: shards check || shards install --without-development | |
| - name: Run tests | |
| run: KEMAL_ENV=test crystal spec --order=random --error-on-warnings | |
| - name: Collect 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=apple-darwin.tar.gz" >> $GITHUB_ENV | |
| echo "BUILD_ARGS=" >> $GITHUB_ENV | |
| - name: Set asset name | |
| run: | | |
| echo "ASSERT_NAME=${{env.BINARY_NAME}}-${{github.ref_name}}-${{env.PKG_ARCH}}-${{env.PLATFORM}}" >> $GITHUB_ENV | |
| - name: Build release binary | |
| id: release | |
| run: | | |
| echo "ASSERT_NAME=${{env.ASSERT_NAME}}" >> $GITHUB_OUTPUT | |
| shards build --production --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@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: | | |
| ${{steps.release.outputs.ASSERT_NAME}} |