Bump go version #15
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: create-tag | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "version.go" | |
jobs: | |
unit-test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Setup Go | |
continue-on-error: false | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.21" # The Go version to download (if necessary) and use. | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
continue-on-error: false | |
- name: Cache Go modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.OS }}-build-${{ env.cache-name }}- | |
${{ runner.OS }}-build- | |
${{ runner.OS }}- | |
- name: Run tests | |
continue-on-error: false | |
run: | | |
echo "$(go version)" | |
go test | |
cut-tag: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
continue-on-error: false | |
- name: Get Version | |
continue-on-error: false | |
run: | | |
echo VERSION=`grep -E "MAJOR|MINOR|PATCH" version.go | cut -d '"' -f 2 | xargs echo -n | tr -s " " "."` >> $GITHUB_ENV | |
- name: Create tag | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
github.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "refs/tags/v${{ env.VERSION }}", | |
sha: context.sha | |
}) |