name: Release on: push: tags: - 'v*.*.*' permissions: contents: write jobs: release: name: Create Release runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v5 with: go-version-file: 'go.mod' check-latest: true - name: Run tests run: go test -v ./... - name: Install UPX run: | sudo apt-get update sudo apt-get install -y upx - name: Build binaries run: | # Set the build time environment variable using git commit timestamp BUILD_TIME=$(git log -1 --format=%cd --date=iso-strict) # Add run permissions to the build script chmod +x ./scripts/build.sh # Build for all platforms ./scripts/build.sh \ --verbose \ -ldflags "-s -w -X github.com/kjanat/articulate-parser/internal/version.Version=${{ github.ref_name }} -X github.com/kjanat/articulate-parser/internal/version.BuildTime=$BUILD_TIME -X github.com/kjanat/articulate-parser/internal/version.GitCommit=${{ github.sha }}" - name: Compress binaries run: | cd build/ for binary in articulate-parser-*; do echo "Compressing $binary..." upx --best "$binary" || { echo "Warning: UPX compression failed for $binary, keeping original" } done - name: Create Release uses: softprops/action-gh-release@v2 with: files: | build/articulate-parser-linux-amd64 build/articulate-parser-linux-arm64 build/articulate-parser-windows-amd64.exe build/articulate-parser-windows-arm64.exe build/articulate-parser-darwin-amd64 build/articulate-parser-darwin-arm64 generate_release_notes: true draft: false # Mark pre-1.0 versions (v0.x.x) as prerelease since they are considered unstable # This helps users understand that these releases may have breaking changes prerelease: ${{ startsWith(github.ref, 'refs/tags/v0.') }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}