diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d8e7f86..c324970 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -6,6 +6,8 @@ name: Go on: push: branches: [ "master" ] + tags: + - "v*" pull_request: branches: [ "master" ] @@ -26,3 +28,33 @@ jobs: - name: Test run: go test -v ./... + + create-release: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') # Only run this job when a valid tag is pushed + steps: + - name: Check if tag exists + id: check_tag + run: | + if [ -n "$GITHUB_REF" ]; then + TAG=${GITHUB_REF#refs/tags/} + # echo "::set-output name=tag::$TAG" + echo "TAG=${TAG}" >> $GITHUB_ENV + else + # echo "::set-output name=tag::" + echo "TAG=" >> $GITHUB_ENV + fi + shell: bash + + - name: Create GitHub Release + id: create_release + uses: softprops/action-gh-release@v1 + with: + # tag_name: ${{ steps.check_tag.outputs.tag }} + tag_name: ${{ env.TAG }} + body: | + :gem: released new version ${{ env.TAG }} + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}