Skip to content

Merge pull request #13 from EikaGruppen/only-scope-param-if-set #12

Merge pull request #13 from EikaGruppen/only-scope-param-if-set

Merge pull request #13 from EikaGruppen/only-scope-param-if-set #12

Workflow file for this run

name: Auto-release
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: 1.18.x
- name: Fetch tags
run: git fetch --tags -f
- name: Tag
run: |
latestTag=$(git describe --tags --abbrev=0)
commits=$(git log $latestTag..HEAD --pretty="format:%B" --no-merges)
latestRelease="${latestTag:1}"
major=$(echo $latestRelease | cut -d '.' -f1)
minor=$(echo $latestRelease | cut -d '.' -f2)
patch=$(echo $latestRelease | cut -d '.' -f3)
if echo "$commits" | grep "BREAKING CHANGE" >/dev/null 2>&1 ; then
major=$((major + 1))
minor=0
patch=0
git tag v$major.$minor.$patch
git push origin v$major.$minor.$patch
GOPROXY=proxy.golang.org go list -m github.com/EikaGruppen/go-oauth-cli-client@v$major.$minor.$patch
exit 0
fi
if echo "$commits" | grep -E "(^feat:|^feat\()" >/dev/null 2>&1; then
minor=$((minor + 1))
patch=0
git tag v$major.$minor.$patch
git push origin v$major.$minor.$patch
GOPROXY=proxy.golang.org go list -m github.com/EikaGruppen/go-oauth-cli-client@v$major.$minor.$patch
exit 0
fi
if echo "$commits" | grep -E "(^fix:|^fix\(|^refactor:|^refactor\(|^perf:|^perf\()" >/dev/null 2>&1 ; then
patch=$((patch + 1))
git tag v$major.$minor.$patch
git push origin v$major.$minor.$patch
GOPROXY=proxy.golang.org go list -m github.com/EikaGruppen/go-oauth-cli-client@v$major.$minor.$patch
exit 0
fi
echo No release