Sync Boatstack from Intelligence Flow Labs @ c03b39132314 (#145) #107
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
| # Boatstack-owned control plane. | |
| name: Release Boatstack helper | |
| on: | |
| push: | |
| tags: ["v*"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - goos: linux | |
| goarch: amd64 | |
| asset: boatstack-helper_linux_amd64 | |
| - goos: linux | |
| goarch: arm64 | |
| asset: boatstack-helper_linux_arm64 | |
| - goos: darwin | |
| goarch: amd64 | |
| asset: boatstack-helper_darwin_amd64 | |
| - goos: darwin | |
| goarch: arm64 | |
| asset: boatstack-helper_darwin_arm64 | |
| - goos: windows | |
| goarch: amd64 | |
| asset: boatstack-helper_windows_amd64.exe | |
| - goos: windows | |
| goarch: arm64 | |
| asset: boatstack-helper_windows_arm64.exe | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: boatstack/go.mod | |
| cache-dependency-path: boatstack/go.mod | |
| - name: Build native helper | |
| shell: bash | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: "0" | |
| ASSET: ${{ matrix.asset }} | |
| VERSION: ${{ github.ref_name }} | |
| run: | | |
| source_commit="$(jq -r '.source.commit' UPSTREAM.json)" | |
| mkdir -p dist | |
| cd boatstack | |
| go build -trimpath \ | |
| -ldflags "-s -w -X github.com/operatorstack/boatstack/boatstack.Version=$VERSION -X github.com/operatorstack/boatstack/boatstack.SourceCommit=$source_commit -X github.com/operatorstack/boatstack/boatstack.ChecksumsSHA256=per-asset-sidecar" \ | |
| -o "../dist/$ASSET" ./cmd/boatstack-helper | |
| cd ../dist | |
| sha256sum "$ASSET" > "$ASSET.sha256" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.asset }} | |
| path: dist/${{ matrix.asset }}* | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Publish release assets | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| shell: bash | |
| run: | | |
| previous_tag="$(git describe --tags --abbrev=0 "${GITHUB_REF_NAME}^" 2>/dev/null || true)" | |
| if [[ -n "$previous_tag" ]]; then | |
| rewritten_notes=() | |
| while IFS= read -r note; do | |
| rewritten_notes+=("$note") | |
| done < <(git diff --name-only --diff-filter=MD --no-renames \ | |
| "$previous_tag" "$GITHUB_REF_NAME" -- 'release-notes/*.md') | |
| release_notes=() | |
| while IFS= read -r note; do | |
| release_notes+=("$note") | |
| done < <(git diff --name-only --diff-filter=A --no-renames \ | |
| "$previous_tag" "$GITHUB_REF_NAME" -- 'release-notes/*.md' | LC_ALL=C sort) | |
| else | |
| rewritten_notes=() | |
| release_notes=() | |
| while IFS= read -r note; do | |
| release_notes+=("$note") | |
| done < <(git ls-tree -r --name-only "$GITHUB_REF_NAME" -- \ | |
| 'release-notes/*.md' | LC_ALL=C sort) | |
| fi | |
| if (( ${#rewritten_notes[@]} > 0 )); then | |
| echo "BLOCKED: Boatstack release notes are append-only:" >&2 | |
| printf ' %s\n' "${rewritten_notes[@]}" >&2 | |
| exit 1 | |
| fi | |
| if (( ${#release_notes[@]} == 0 )); then | |
| echo "BLOCKED: this tag contains no release-level Boatstack message." >&2 | |
| exit 1 | |
| fi | |
| release_body="$(mktemp)" | |
| { | |
| echo "## What's in this release" | |
| echo | |
| for note in "${release_notes[@]}"; do | |
| cat "$note" | |
| echo | |
| done | |
| } > "$release_body" | |
| gh release create "${GITHUB_REF_NAME}" dist/* \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --notes-file "$release_body" \ | |
| --verify-tag |