-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa7a6ab
commit 0c6d3b3
Showing
3 changed files
with
253 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,99 @@ | ||
# 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: Install Mage | ||
run: go install github.com/magefile/mage@latest | ||
|
||
- name: Run Mage | ||
run: | | ||
mage build | ||
mage tools | ||
- 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/*" | ||
# 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: Install Mage | ||
run: go install github.com/magefile/mage@latest | ||
|
||
- name: Run Mage | ||
uses: magefile/mage-action@v3 | ||
with: | ||
version: latest | ||
args: build | ||
|
||
- name: Run Mage | ||
uses: magefile/mage-action@v3 | ||
with: | ||
version: latest | ||
args: tools | ||
|
||
- 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/*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters