on: push: tags: - '*' name: Release concurrency: group: kubeshark-publish-${{ github.ref }} cancel-in-progress: true jobs: release: name: Build and publish a new release runs-on: ubuntu-latest steps: - name: Check out the repo uses: actions/checkout@v3 - name: Set up Go uses: actions/setup-go@v4 with: go-version-file: 'go.mod' - name: Version id: version shell: bash run: | { echo "tag=${GITHUB_REF#refs/*/}" echo "build_timestamp=$(date +%s)" echo "branch=${GITHUB_REF#refs/heads/}" } >> "$GITHUB_OUTPUT" - name: Build run: make build-all VER='${{ steps.version.outputs.tag }}' BUILD_TIMESTAMP='${{ steps.version.outputs.build_timestamp }}' - name: Log the version into a .txt file shell: bash run: | echo '${{ steps.version.outputs.tag }}' >> bin/version.txt - name: Release uses: ncipollo/release-action@v1 with: token: ${{ secrets.GITHUB_TOKEN }} artifacts: "bin/*" tag: ${{ steps.version.outputs.tag }} prerelease: true bodyFile: 'bin/README.md' brew-tap: name: Create Homebrew formulae runs-on: ubuntu-latest needs: [release] steps: - name: Checkout uses: actions/checkout@v3 with: fetch-depth: 0 - name: Version id: version shell: bash run: | { echo "tag=${GITHUB_REF#refs/*/}" echo "build_timestamp=$(date +%s)" echo "branch=${GITHUB_REF#refs/heads/}" } >> "$GITHUB_OUTPUT" - name: Fetch all tags run: git fetch --force --tags - name: Set up Go uses: actions/setup-go@v4 with: go-version-file: 'go.mod' - name: Run GoReleaser uses: goreleaser/goreleaser-action@v4 with: distribution: goreleaser version: ${{ env.GITHUB_REF_NAME }} args: release --clean env: GITHUB_TOKEN: ${{ secrets.HOMEBREW_TOKEN }} VER: ${{ steps.version.outputs.tag }} BUILD_TIMESTAMP: ${{ steps.version.outputs.build_timestamp }}