Skip to content

ci: add workflow to force-push major tag to latest #1

ci: add workflow to force-push major tag to latest

ci: add workflow to force-push major tag to latest #1

Workflow file for this run

name: Release Action
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
Release:
permissions: write-all
runs-on: ubuntu-latest
concurrency: release
steps:
- uses: actions/setup-python@v3
with:
python-version: 3.8
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check release status
id: release-status
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install python-semantic-release
if semantic-release --noop --strict version
then
echo "Releasing new version."
else
echo "Skipping release step."
fi
- if: steps.release-status.outputs.released == 'true'
name: Release to GitHub
id: github-release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
semantic-release version --no-vcs-release
git fetch --tags
VERSION="${{ steps.release-status.outputs.tag }}"
MAJOR=${VERSION%%.*}
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git tag -fa ${MAJOR} -m "Update major version tag"
git push origin ${MAJOR} --force