Release (Manual) #24
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
name: Release (Manual) | |
on: | |
workflow_dispatch: | |
inputs: | |
name: | |
description: "Semver - major, minor, patch" | |
default: "patch" | |
jobs: | |
semver: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check input | |
run: | | |
echo "Version: ${{ github.event.inputs.name }}" | |
if [ ${{ github.event.inputs.name }} != "major" ] || [ ${{ github.event.inputs.name }} != "minor" ] || [ ${{ github.event.inputs.name }} != "patch" ]; then | |
echo "Error: Provided input string must be 'major', 'minor', or 'patch'" | |
exit 1 | |
fi | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} # required for better experience using pre-releases | |
fetch-depth: '0' | |
- name: Checkout go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' # The Go version to download (if necessary) and use. | |
- name: Go version | |
id: Version | |
run: go version | |
- name: Go download | |
run: go mod download | |
- name: Go test | |
run: go test -v ./... | |
continue-on-error: false | |
- name: Create dry run tag | |
uses: anothrNick/github-tag-action@1.67.0 | |
id: semver-tag-dry | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
WITH_V: false | |
INITIAL_VERSION: 1.0.0 | |
RELEASE_BRANCHES: master | |
DEFAULT_BUMP: ${{ github.event.inputs.name }} | |
PRERELEASE: false | |
DRY_RUN: true | |
VERBOSE: true | |
- name: Commit new version tag to version file | |
run: | | |
echo ${{ steps.semver-tag-dry.outputs.tag }} > version | |
- name: Create release | |
run: | | |
git config --global user.email "release-bot@users.noreply.github.com" | |
git config --global user.name "release-bot" | |
git commit -a -m "#{{ github.event.inputs.name }} - Setting semantic version" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
- name: Create dry run tag | |
uses: anothrNick/github-tag-action@1.67.0 | |
id: semver-tag #test4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
WITH_V: false | |
INITIAL_VERSION: 1.0.0 | |
RELEASE_BRANCHES: master | |
DEFAULT_BUMP: ${{ github.event.inputs.name }} | |
PRERELEASE: false | |
DRY_RUN: false | |
VERBOSE: true | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RELEASE_VERSION: ${{ steps.semver-tag.outputs.tag }} | |
CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} |