chore(release): 0.9.0 #17
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
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: read | |
| env: | |
| # Matches the floor declared in shard.yml. The alpine image is multi-arch, so | |
| # the same tag builds on both the x86_64 and arm64 runners. | |
| BUILD_IMAGE: crystallang/crystal:1.21.0-alpine | |
| jobs: | |
| build: | |
| name: build ${{ matrix.target }} | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: linux-amd64 | |
| runner: ubuntu-latest | |
| - target: linux-arm64 | |
| runner: ubuntu-24.04-arm | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| # Built inside Alpine so `--static` links against musl and the release | |
| # artifact does not depend on the runner's glibc. Checkout and packaging | |
| # stay on the host runner, which avoids running the Actions node runtime | |
| # under musl. | |
| - name: Build static release binary | |
| run: | | |
| docker run --rm -v "${PWD}":/workspace -w /workspace "${BUILD_IMAGE}" \ | |
| sh -c 'shards install --production && mkdir -p bin && crystal build --release --static src/obsctl.cr -o bin/obsctl' | |
| - name: Verify the binary is static and runnable | |
| run: | | |
| sudo chown "$(id -u):$(id -g)" bin/obsctl | |
| file bin/obsctl | |
| ldd bin/obsctl 2>&1 | grep -qE 'not a dynamic executable|statically linked' | |
| ./bin/obsctl --version | |
| - name: Package binary | |
| run: | | |
| ARCHIVE="obsctl-${GITHUB_REF_NAME}-${{ matrix.target }}.tar.gz" | |
| tar -czf "${ARCHIVE}" -C bin obsctl | |
| sha256sum "${ARCHIVE}" > "${ARCHIVE}.sha256" | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: obsctl-${{ matrix.target }} | |
| path: | | |
| obsctl-*.tar.gz | |
| obsctl-*.tar.gz.sha256 | |
| if-no-files-found: error | |
| release: | |
| name: publish release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| # The installer ships as a release asset too, so a pinned install can | |
| # fetch the script that matches the tag it is installing. | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Collect checksums | |
| working-directory: dist | |
| run: | | |
| cat ./*.tar.gz.sha256 > SHA256SUMS.txt | |
| rm -f ./*.tar.gz.sha256 | |
| sha256sum -c SHA256SUMS.txt | |
| cat SHA256SUMS.txt | |
| - name: Create GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| dist/obsctl-*.tar.gz | |
| dist/SHA256SUMS.txt | |
| install.sh | |
| generate_release_notes: true | |
| fail_on_unmatched_files: true |