Skip to content

✨ Changed CI/CD

✨ Changed CI/CD #28

Workflow file for this run

name: "Release"
on:
push:
tags:
- "v*.*.*" # Match tags that start with 'v'
workflow_dispatch:
inputs:
tag:
description: Tag for automatic release
required: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: fregante/setup-git-user@v2
- name: Setting up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Setting up the environment
run: pip install tomlkit
- name: Setting a branch
run: git checkout main12312 && git checkout -b post_release_branch
- name: Get latest tag
id: var
run: |
if [ "${{ github.event_name }}" == "push" ]; then
tag=$(git describe --tags --abbrev=0)
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
tag="${{ github.event.inputs.tag }}"
fi
echo "tag=$tag" >> $GITHUB_OUTPUT
shell: bash
- name: Updating version in pyproject.toml
run: |
python .github/scripts/update_pyproject_version.py --tag ${{ steps.var.outputs.tag }}
- name: Commit changes
run: |
git add pyproject.toml &&
# Committing changes with version updates in files.
# If there are no changes, the step succeeds, and the workflow proceeds to the 'Creating Release' step.
git commit -m"🚀 Updated files after release" || { echo "Nothing to commit. Exiting." && exit 0; }
# In the case of committing changes, it creates a pull request and merges the changes into the main branch.
git push --set-upstream origin post_release_branch --force
gh pr create -B main -H post_release_branch --title "🚀 Updated files after release" --body "Created by Github action"
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
- name: merge PR
run: |
gh pr merge --admin --squash -t "🚀 Updated files after release"
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
- name: Upload Release
uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
tag: ${{ steps.var.outputs.tag }}
token: ${{ secrets.TOKEN }}