Update continuous_delivery.yml #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CD | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
check_version_and_publish: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ 3.8, 3.9 ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
export PATH="$HOME/.poetry/bin:$PATH" | |
- name: Install project dependencies with Poetry | |
run: | | |
poetry install | |
- name: Extract version from pyproject.toml | |
id: extract_version | |
run: | | |
VERSION=$(poetry version -s) | |
echo "PACKAGE_VERSION=${VERSION}" >> $GITHUB_ENV | |
- name: Verify if version has changed | |
id: version_check | |
run: | | |
if [ $(git tag -l "v${{ env.PACKAGE_VERSION }}") ]; then | |
echo "Version ${{ env.PACKAGE_VERSION }} already exists." | |
exit 0 | |
fi | |
- name: Create a Git tag | |
if: ${{ success() && matrix.python-version == 3.8 }} | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "GitHub Actions" | |
git tag "v${{ env.PACKAGE_VERSION }}" | |
git push origin "v${{ env.PACKAGE_VERSION }}" |