Skip to content

Create Release

Create Release #19

name: Create Release
on:
create
jobs:
create-release:
if: startsWith(github.ref_name, 'version-') && endsWith(github.ref_name, '-create-release')
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Setup
id: setup
run: |
# install python dependencies
pip install typer==0.4.0 click==8.0.3
# variables
RELEASE_VERSION='${{ github.ref_name }}'
RELEASE_VERSION=${RELEASE_VERSION//version-/}
RELEASE_VERSION=${RELEASE_VERSION//-create-release/}
echo "::set-output name=RELEASE_VERSION::${RELEASE_VERSION}"
- name: Update version
run: |
RELEASE_VERSION='${{ steps.setup.outputs.RELEASE_VERSION }}'
# setup git
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
# switch to main
git pull origin main
git checkout main
# update version
python scripts/update_version.py $RELEASE_VERSION
git commit -am "Update version to $RELEASE_VERSION"
# create tag
git fetch --tags
git tag $RELEASE_VERSION
# push to main
git push
git push --tags
# delete branch
git push -d origin ${{ github.ref_name }}
- name: Create Release
uses: actions/create-release@v1
with:
tag_name: ${{ steps.setup.outputs.RELEASE_VERSION }}
release_name: ${{ steps.setup.outputs.RELEASE_VERSION }}
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}