v0.2.0 Release Notes #3
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: | |
| - "*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| # fail early if release notes dont exist | |
| release-notes-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Fail early if release notes dont exist on a tagged release | |
| if: github.ref_type == 'tag' | |
| run: | | |
| FILE="${{ github.ref_name }}-RELEASE.md" | |
| if [ ! -f "$FILE" ]; then | |
| echo "Release notes werent found for this tagged release. Aborting." | |
| exit 1 | |
| fi | |
| echo "Found release notes" | |
| build: | |
| needs: release-notes-check | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - os: linux | |
| arch: amd64 | |
| - os: linux | |
| arch: arm64 | |
| - os: darwin | |
| arch: amd64 | |
| - os: darwin | |
| arch: arm64 | |
| - os: windows | |
| arch: amd64 | |
| - os: windows | |
| arch: arm64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.25" | |
| - name: Build | |
| run: | | |
| mkdir -p dist | |
| EXT="" | |
| if [ "${{ matrix.os }}" = "windows" ]; then EXT=".exe"; fi | |
| if [ "${{ github.ref_type }}" = "tag" ]; then | |
| VERSION="${{ github.ref_name }}" | |
| else | |
| VERSION="development-build" | |
| fi | |
| COMMIT=${{ github.sha }} | |
| DATE=$(date -u +"%Y-%m-%d@%H:%M:%S") | |
| GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} \ | |
| go build \ | |
| -ldflags "\ | |
| -X sklair/constants.Version=$VERSION \ | |
| -X sklair/constants.Commit=$COMMIT \ | |
| -X sklair/constants.BuildDate=$DATE \ | |
| " \ | |
| -o dist/sklair-${{ matrix.os }}-${{ matrix.arch }}$EXT | |
| - name: Upload artefacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: sklair-${{ matrix.os }}-${{ matrix.arch }} | |
| path: dist/* | |
| release: | |
| needs: | |
| - release-notes-check | |
| - build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 # this is only used to get the release notes for action-gh-release | |
| - name: Download artefacts | |
| uses: actions/download-artifact@v7 | |
| with: | |
| path: dist | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| if: github.ref_type == 'tag' | |
| with: | |
| files: dist/**/* | |
| body_path: ${{ github.ref_name }}-RELEASE.md | |
| # generate_release_notes: true |