Release #12
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 | |
| run: | | |
| FILE_VERSION="$(cat VERSION)" | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| RELEASE_VERSION="${{ github.event.inputs.version }}" | |
| else | |
| RELEASE_VERSION="${GITHUB_REF_NAME#v}" | |
| fi | |
| if [ "$RELEASE_VERSION" != "$FILE_VERSION" ]; then | |
| echo "::error::Version mismatch: Input/Tag ($RELEASE_VERSION) != VERSION file ($FILE_VERSION)" | |
| 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 }}" |