Skip to content

Feat/add updated at (#10) #2

Feat/add updated at (#10)

Feat/add updated at (#10) #2

Workflow file for this run

name: On Merge
on:
push:
branches:
- main
jobs:
tag:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Read version from semver.version
id: read-version
run: |
VERSION=$(cat semver.version)
BASE_VERSION=$(echo "$VERSION" | sed 's/\.[0-9]*$//')
echo "BASE_VERSION=$BASE_VERSION" >> $GITHUB_ENV
- name: Get latest patch number
id: get-latest-tag
run: |
LATEST_TAG=$(git tag -l "v${{ env.BASE_VERSION }}.*" | sort -V | tail -n1 || echo "v${{ env.BASE_VERSION }}.1")
PATCH_NUM=$(echo "$LATEST_TAG" | grep -oE "[0-9]+$" || echo "0")
NEW_PATCH=$((PATCH_NUM + 1))
NEW_TAG="v${{ env.BASE_VERSION }}.$NEW_PATCH"
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
- name: Create and push tags
run: |
git tag ${{ env.NEW_TAG }}
git tag go-client/${{ env.NEW_TAG }}
git push origin ${{ env.NEW_TAG }}
git push origin go-client/${{ env.NEW_TAG }}