Skip to content

Create Release

Create Release #7

# 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/*"