Skip to content

Revert "Update go.yml" #69

Revert "Update go.yml"

Revert "Update go.yml" #69

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
pull_request:
types:
- closed
branches: [ "main" ]
jobs:
build:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
- name: Get Latest Tag
id: latest-tag
run: echo "tag=$(git tag -l | sort -V | tail -1 | sed 's/-dev$//')" >> "$GITHUB_OUTPUT"
- name: Generate New Bumped Version
uses: actions-ecosystem/action-bump-semver@v1
id: bump-semver
with:
current_version: ${{ steps.latest-tag.outputs.tag }}
level: patch
- name: Create Release Notes
id: create-release
run: |
curl -f -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "authorization: Bearer ${{ secrets.TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/releases \
-d '{"tag_name":"${{ steps.bump-semver.outputs.new_version }}", "target_commitish": "${{ github.ref_name }}", "generate_release_notes":true}'