-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (42 loc) · 1.47 KB
/
go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 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}'