Skip to content

Delete testing RDS instance for cost efficiency (#32) #8

Delete testing RDS instance for cost efficiency (#32)

Delete testing RDS instance for cost efficiency (#32) #8

name: Publish version to GitHub
on:
push:
branches:
- main
jobs:
create-version:
name: Create GH version and tag
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set version
id: set-version
run: |
POETRY_VERSION=$(grep -E '^requires-poetry = ' pyproject.toml | sed -E 's/requires-poetry = "(.*)"/\1/')
pip install poetry==$POETRY_VERSION
VERSION=$(poetry version -s)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Check if release exists
id: check-release
env:
VERSION: ${{ steps.set-version.outputs.VERSION }}
run: |
git fetch --tags
if [ -n "$(git tag -l "$VERSION")" ]; then
echo "## ⚠️ Tag $VERSION already exists in git. Skipping publish." >> $GITHUB_STEP_SUMMARY
echo "skip_publish=true" >> $GITHUB_OUTPUT
else
echo "skip_publish=false" >> $GITHUB_OUTPUT
fi
- name: Create and push annotated git tag
if: steps.check-release.outputs.skip_publish != 'true'
env:
VERSION: ${{ steps.set-version.outputs.VERSION }}
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
git tag -a "$VERSION" -m "Release $VERSION"
git push origin "$VERSION"
- name: Create GitHub release
if: steps.check-release.outputs.skip_publish != 'true'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.set-version.outputs.VERSION }}
name: Release ${{ steps.set-version.outputs.VERSION }}
generate_release_notes: true