fix condition #8
Workflow file for this run
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 Step) | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
name: | ||
description: "Enter - major, minor, patch" | ||
default: "patch" | ||
jobs: | ||
tfswitch-release: | ||
name: Release | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check if provided input is valid | ||
run: | | ||
echo "Semantic Version: ${{ github.event.inputs.name }}" | ||
VERSION=${{ github.event.inputs.name }} | ||
if [ "$VERSION" != "major" ] && [ "$VERSION" != "minor" ] && [ "$VERSION" != "patch" ]; then | ||
echo "Error: Provided input string must be 'major', 'minor', or 'patch'" | ||
exit 1 | ||
fi | ||
# Checkout code from repo | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.head_ref }} # required for better experience using pre-releases | ||
#fetch-depth: '0' | ||
# Install go | ||
- name: Checkout go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22' # The Go version to download (if necessary) and use. | ||
# Double check go version | ||
- name: Go version | ||
id: Version | ||
run: go version | ||
# Download dependencies | ||
- name: Go download | ||
run: go mod download | ||
# Test to see if tfswitch works with --help | ||
- name: Go build | ||
run: mkdir -p build && go build -v -o build/tfswitch && build/tfswitch --help | ||
continue-on-error: false | ||
- name: Create dry 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 #only get the tag | ||
VERBOSE: true | ||
# Write new version into version file | ||
- name: Write new version tag to version file | ||
run: | | ||
echo ${{ steps.semver-tag-dry.outputs.tag }} > version | ||
- name: Commit version into repo | ||
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 }} | ||
# Introduce new tag | ||
- name: Bump version and push tag | ||
uses: anothrNick/github-tag-action@1.67.0 | ||
id: semver-tag | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
WITH_V: false | ||
INITIAL_VERSION: 1.0.0 | ||
RELEASE_BRANCHES: release | ||
DEFAULT_BUMP: patch | ||
PRERELEASE: false | ||
DRY_RUN: false | ||
VERBOSE: true | ||
BRANCH_HISTORY: last | ||
TAG_CONTEXT: branch | ||
# Run goreleaser to create new binaries | ||
- 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 }} | ||
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
- name: Install Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.x | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install mkdocs-material | ||
- name: Build page | ||
run: cd www && mkdocs gh-deploy --force | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||