fix: improve cleanup file detection and add metrics tracking (#96) #14
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: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| build_time: ${{ steps.version.outputs.build_time }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.23' | |
| - name: Get version info | |
| id: version | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "build_time=$BUILD_TIME" >> $GITHUB_OUTPUT | |
| - name: Run tests | |
| run: make test | |
| - name: Build for multiple platforms | |
| run: | | |
| VERSION=${{ steps.version.outputs.version }} | |
| BUILD_TIME=${{ steps.version.outputs.build_time }} | |
| LDFLAGS="-X main.version=${VERSION} -X main.buildTime=${BUILD_TIME}" | |
| # Linux AMD64 | |
| GOOS=linux GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o tenangdb-linux-amd64 cmd/main.go | |
| GOOS=linux GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o tenangdb-exporter-linux-amd64 cmd/tenangdb-exporter/main.go | |
| # Linux ARM64 | |
| GOOS=linux GOARCH=arm64 go build -ldflags "${LDFLAGS}" -o tenangdb-linux-arm64 cmd/main.go | |
| GOOS=linux GOARCH=arm64 go build -ldflags "${LDFLAGS}" -o tenangdb-exporter-linux-arm64 cmd/tenangdb-exporter/main.go | |
| # macOS AMD64 | |
| GOOS=darwin GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o tenangdb-darwin-amd64 cmd/main.go | |
| GOOS=darwin GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o tenangdb-exporter-darwin-amd64 cmd/tenangdb-exporter/main.go | |
| # macOS ARM64 | |
| GOOS=darwin GOARCH=arm64 go build -ldflags "${LDFLAGS}" -o tenangdb-darwin-arm64 cmd/main.go | |
| GOOS=darwin GOARCH=arm64 go build -ldflags "${LDFLAGS}" -o tenangdb-exporter-darwin-arm64 cmd/tenangdb-exporter/main.go | |
| # Windows AMD64 | |
| GOOS=windows GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o tenangdb-windows-amd64.exe cmd/main.go | |
| GOOS=windows GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o tenangdb-exporter-windows-amd64.exe cmd/tenangdb-exporter/main.go | |
| - name: Create checksums | |
| run: | | |
| sha256sum tenangdb-* > checksums.txt | |
| - name: Create release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| tenangdb-linux-amd64 | |
| tenangdb-exporter-linux-amd64 | |
| tenangdb-linux-arm64 | |
| tenangdb-exporter-linux-arm64 | |
| tenangdb-darwin-amd64 | |
| tenangdb-exporter-darwin-amd64 | |
| tenangdb-darwin-arm64 | |
| tenangdb-exporter-darwin-arm64 | |
| tenangdb-windows-amd64.exe | |
| tenangdb-exporter-windows-amd64.exe | |
| checksums.txt | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |