Release #8
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: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (e.g., 0.1.0)' | |
| required: true | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Read version from file | |
| id: version | |
| run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT | |
| - name: Validate version matches tag | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| TAG_VERSION="${GITHUB_REF_NAME#v}" | |
| FILE_VERSION="$(cat VERSION)" | |
| if [ "$TAG_VERSION" != "$FILE_VERSION" ]; then | |
| echo "::error::Tag version ($TAG_VERSION) does not match VERSION file ($FILE_VERSION)" | |
| echo "Update the VERSION file to $TAG_VERSION before tagging." | |
| exit 1 | |
| fi | |
| echo "Version validated: $FILE_VERSION" | |
| - name: Create Release | |
| uses: whilesmart/workflows/go/release@main | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| binary_name: flatrun-agent | |
| build_path: ./cmd/agent | |
| version: ${{ github.event.inputs.version || steps.version.outputs.version }} | |
| platforms: '["linux/amd64", "linux/arm64", "darwin/amd64", "darwin/arm64"]' | |
| ldflags: "-X github.com/flatrun/agent/pkg/version.Version=${{ github.event.inputs.version || steps.version.outputs.version }} -X github.com/flatrun/agent/pkg/version.BuildTime=$(date -u +%Y-%m-%d_%H:%M:%S) -X github.com/flatrun/agent/pkg/version.GitCommit=${{ github.sha }}" |