Skip to content

Fix issues with release action #8

Fix issues with release action

Fix issues with release action #8

Workflow file for this run

name: Versioned Release
on:
pull_request:
push:
branches:
- main
permissions:
contents: write # we need this to be able to push tags
jobs:
release_tag:
name: Release version
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.PUSH_KEY }}
- name: Read and validate VERSION
id: version
run: |
VERSION=$(cat VERSION)
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-dev)?$ ]]; then
echo "Invalid version format in VERSION file: $VERSION"
exit 1
fi
echo "New version: $VERSION"
echo "version=$VERSION" >> $GITHUB_ENV
- name: Skip release if version is a dev version
if: contains(env.version, '-dev')
run: |
echo "Skipping development version release: ${{ env.version }}"
exit 0
- name: Check if VERSION is already tagged
id: check_tag
run: |
if git rev-parse "refs/tags/${{ env.version }}" >/dev/null 2>&1; then
echo "Tag ${{ env.version }} already exists. Skipping release."
exit 0
fi
echo "Tag ${{ env.version }} doesn't exists. Proceeding with release."
# - name: Create Git tag
# run: |
# AUTHOR_NAME=$(git log -1 --pretty=format:'%an')
# AUTHOR_EMAIL=$(git log -1 --pretty=format:'%ae')
# echo "Tagging as $AUTHOR_NAME <$AUTHOR_EMAIL>"
# echo "AUTHOR_NAME=$AUTHOR_NAME" >> $GITHUB_ENV
# echo "AUTHOR_EMAIL=$AUTHOR_EMAIL" >> $GITHUB_ENV
# git config user.name "$AUTHOR_NAME"
# git config user.email "$AUTHOR_EMAIL"
# git tag -a "${{ env.version }}" -m "Release ${{ env.version }}"
# git push origin "${{ env.version }}"
# - name: Create GitHub release
# uses: softprops/action-gh-release@v2
# with:
# tag_name: ${{ env.version }}
# name: Release ${{ env.version }}
# body: "Automated release for version ${{ env.version }}"
# draft: false
# prerelease: false
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Push dev VERSION
# run: |
# echo "${{ env.version }}-dev" > VERSION
# git config user.name "${{ env.AUTHOR_NAME }}"
# git config user.email "${{ env.AUTHOR_EMAIL }}"
# git add VERSION
# git commit -m "Update VERSION to ${{ env.version }}-dev"
# git push origin main