name: release on: push: pull_request: branches: [master] jobs: release: name: release runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/v') steps: - name: Checkout uses: actions/checkout@v2 - name: Setup Go uses: actions/setup-go@v2 with: go-version: ^1.17 - name: Set GOVERSION run: echo "GOVERSION=$(go version | sed -r 's/go version go(.*)\ .*/\1/')" >> $GITHUB_ENV - name: Set package version run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - name: Show versions run: echo Go ${{ env.GOVERSION }}, app ${{ env.VERSION }} - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: version: latest args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}