-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (77 loc) · 2.43 KB
/
create-release.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# 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: "Create Release"
on:
workflow_dispatch:
inputs:
version:
description: 'What release version should be created?'
required: true
type: choice
default: 'patch'
options:
- 'patch'
- 'minor'
- 'major'
concurrency:
group: 'create-release'
cancel-in-progress: false
permissions:
contents: write
pull-requests: write
issues: write
discussions: write
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ vars.GO_VERSION }}
cache-dependency-path: "**/*.sum"
- name: Build binaries
run: |
go build -o bin/goschema ./cmd/schema
go build -o bin/vaultdb ./cmd/vaultdb
- name: Create Changelog
run: |
wget "https://github.com/clog-tool/clog-cli/releases/download/v0.9.3/clog-v0.9.3-x86_64-unknown-linux-gnu.tar.gz"
tar xvzf clog-v0.9.3-x86_64-unknown-linux-gnu.tar.gz
./clog -c ./.clog.toml --${{ github.event.inputs.version }}
- name: Copy Changelog to Environment
run: |
echo 'CHANGELOG<<EOF' >> $GITHUB_ENV
cat changelog.md >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Get the new version
id: get_version
run: |
# Get the current version through the changelog file
version=$(cat changelog.md | grep "###" | head -n 1 | cut -d ' ' -f 2)
echo "VERSION=$version" >> $GITHUB_ENV
- name: Create tag
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ env.VERSION }}',
sha: context.sha
})
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: ${{ env.VERSION }}
body: ${{ env.CHANGELOG }}
tag_name: ${{ env.VERSION }}
draft: false
prerelease: false
generate_release_notes: false
make_latest: true
files: "bin/*"