Update Redli Release version #5
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: Update Redli Release version | |
on: | |
push: | |
tags: | |
- 'v*' # Trigger only in case of new tag | |
jobs: | |
update_values: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get tag and set version on release | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
sed -i "s|version = \"v.*\"|version = \"$GITHUB_REF_NAME\"|" version.go | |
cat -n version.go | |
- name: Set VERSION env vars | |
run: | | |
VERSION="$GITHUB_REF_NAME" | |
if [[ $GITHUB_REF != "refs/tags/v"* ]]; then | |
VERSION="${GITHUB_SHA::7}" | |
fi | |
echo "VERSION=$VERSION" | tee -a "$GITHUB_ENV" | |
- name: Checkout branch | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: git checkout -B temp_branch | |
- name: Bump version on release [${{ env.VERSION }}] | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
if [[ $(git diff version.go) != "" ]]; then | |
git add version.go | |
git commit -m "[CI] Bump version to $VERSION" | |
git pull origin master | |
git push origin temp_branch:master | |
fi |