Skip to content

Commit

Permalink
Set new version by incrementing tags
Browse files Browse the repository at this point in the history
  • Loading branch information
makxenov authored and nkaskov committed Apr 27, 2023
1 parent f5b400c commit e1e6f98
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 30 deletions.
62 changes: 33 additions & 29 deletions .github/workflows/set_version.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
name: Set version

on:
# Triggers the workflow on push to master branch
push:
branches: [ master ]

jobs:
set_version:
name: Set and tag version
runs-on: [ubuntu-latest]
env:
VERSION_FILE_NAME: VERSION
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set version
id: set_version
run: |
version=$(cat ${{ env.VERSION_FILE_NAME }} | tr -d '\r').$GITHUB_RUN_NUMBER
echo "VERSION=$version" >> $GITHUB_ENV
- name: Tag new version
run: git tag v${{ env.VERSION }}

- name: Push tags
uses: ad-m/github-push-action@master
with:
tags: true
name: Set version

on:
# Triggers the workflow on push to master branch
push:
branches: [ master ]

jobs:
set_version:
name: Set and tag version
runs-on: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set version
id: set_version
run: |
LATEST_TAG=`git describe --tags | cut -d'-' -f1`
MAJOR=`echo $LATEST_TAG | cut -d'.' -f1`
MINOR=`echo $LATEST_TAG | cut -d'.' -f2`
PATCH=`echo $LATEST_TAG | cut -d'.' -f3`
INCREMENTED=$((PATCH+1))
echo "VERSION=$MAJOR.$MINOR.$INCREMENTED" >> $GITHUB_ENV
- name: Tag new version
run: git tag ${{ env.VERSION }}

- name: Push tags
uses: ad-m/github-push-action@master
with:
tags: true
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

0 comments on commit e1e6f98

Please sign in to comment.