Skip to content

Commit

Permalink
fix(ci): solve the problem that tag made by workflow cannot trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Peterka committed Feb 9, 2024
1 parent 1361967 commit cd0e2a9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 50 deletions.
43 changes: 0 additions & 43 deletions .github/workflows/release-python.yaml

This file was deleted.

40 changes: 34 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "RELEASE"
name: "Release"

on:
workflow_dispatch:
Expand All @@ -13,11 +13,39 @@ jobs:
with: { fetch-depth: 0 } # Required to determine version

- name: Get next release version
uses: dronetag/actions/get-next-version@main
id: get-next-version
uses: dronetag/actions/semantic-release@main
id: semantic

- name: Create the tag
- name: Build package
uses: dronetag/actions/build-python@main
with:
version: ${{ steps.semantic.outputs.version }}

- name: Commit version on release branch
if: ${{ steps.semantic.outputs.existed == 'false' }}
run: |
if [[ $(git rev-parse origin/${{github.event.repository.default_branch}}) = $(git rev-parse HEAD) ]]; then
git checkout ${{github.event.repository.default_branch}} # in case we are on tag
if [[ ! $(git diff --exit-code) ]]; then
git config --local user.email "" && git config --local user.name "GitHub Action"
git diff --name-only | xargs git add
git add changelog.md
git commit -m "Release ${{ steps.semantic.outputs.version }} [skip ci]"
git push origin ${{github.event.repository.default_branch}}
fi
fi
- name: Create the tag (if it does not exist yet)
run: |
git show-ref --tags --verify --quiet "refs/tags/v${{ steps.semantic.outputs.version }}" && exit 0
git config --local user.email "" && git config --local user.name "GitHub Action"
git tag v${{ steps.get-next-version.outputs.version }}
git push origin v${{ steps.get-next-version.outputs.version }}
git tag v${{ steps.semantic.outputs.version }}
git push origin v${{ steps.semantic.outputs.version }}
- name: Release
uses: dronetag/actions/release-python@main
with:
pypi_name: dronetag
pypi_host: ${{ secrets.PRIV_PIP_HOST }}
pypi_user: ${{ secrets.PRIV_PIP_USER }}
pypi_pass: ${{ secrets.PRIV_PIP_PASSWORD }}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools >= 61.0"]
requires = ["setuptools >= 59.0"]
build-backend = "setuptools.build_meta"

[project]
Expand Down

0 comments on commit cd0e2a9

Please sign in to comment.