feat: Implement CI/CD and release workflows, introduce smart data cle… #1
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: | |
| release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.22" | |
| - name: Build binaries | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| LDFLAGS="-s -w -X main.version=$VERSION" | |
| mkdir -p dist | |
| echo "Building for macOS (AMD64)..." | |
| GOOS=darwin GOARCH=amd64 go build -ldflags="$LDFLAGS" -trimpath -o dist/cello-darwin-amd64 . | |
| echo "Building for macOS (ARM64)..." | |
| GOOS=darwin GOARCH=arm64 go build -ldflags="$LDFLAGS" -trimpath -o dist/cello-darwin-arm64 . | |
| echo "Building for Linux (AMD64)..." | |
| GOOS=linux GOARCH=amd64 go build -ldflags="$LDFLAGS" -trimpath -o dist/cello-linux-amd64 . | |
| echo "Building for Linux (ARM64)..." | |
| GOOS=linux GOARCH=arm64 go build -ldflags="$LDFLAGS" -trimpath -o dist/cello-linux-arm64 . | |
| echo "Building for Windows (AMD64)..." | |
| GOOS=windows GOARCH=amd64 go build -ldflags="$LDFLAGS" -trimpath -o dist/cello-windows-amd64.exe . | |
| cd dist | |
| sha256sum * > checksums.txt | |
| - name: Create archives | |
| run: | | |
| cd dist | |
| tar czf cello-darwin-amd64.tar.gz cello-darwin-amd64 | |
| tar czf cello-darwin-arm64.tar.gz cello-darwin-arm64 | |
| tar czf cello-linux-amd64.tar.gz cello-linux-amd64 | |
| tar czf cello-linux-arm64.tar.gz cello-linux-arm64 | |
| zip cello-windows-amd64.zip cello-windows-amd64.exe | |
| - name: Generate changelog | |
| id: changelog | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| # Try to extract changelog for this version | |
| if [ -f "CHANGELOG.md" ]; then | |
| sed -n "/## \[$VERSION\]/,/## \[/p" CHANGELOG.md | sed '$d' > release_notes.md | |
| else | |
| echo "Release $VERSION" > release_notes.md | |
| fi | |
| # Fallback if empty | |
| if [ ! -s release_notes.md ]; then | |
| echo "Release $VERSION" > release_notes.md | |
| fi | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| body_path: release_notes.md | |
| files: | | |
| dist/*.tar.gz | |
| dist/*.zip | |
| dist/checksums.txt | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |