|
5 | 5 | branches: |
6 | 6 | - main |
7 | 7 | pull_request: |
8 | | - workflow_dispatch: |
| 8 | + workflow_call: |
9 | 9 |
|
10 | 10 | jobs: |
11 | 11 | test: |
@@ -45,33 +45,42 @@ jobs: |
45 | 45 | steps: |
46 | 46 | - name: Check out the repo |
47 | 47 | uses: actions/checkout@v4 |
| 48 | + with: |
| 49 | + ref: ${{ github.head_ref }} # checkout the correct branch name |
| 50 | + fetch-depth: 0 |
48 | 51 |
|
49 | 52 | - name: Extract current version |
50 | 53 | id: pyproject_version |
51 | 54 | run: | |
52 | 55 | TAG=v$(grep 'version =' pyproject.toml | sed -e 's/version = "\(.*\)"/\1/') |
53 | 56 | echo "TAG=$TAG" >> "$GITHUB_OUTPUT" |
54 | 57 |
|
55 | | - - name: Semantic Release |
56 | | - uses: cycjimmy/semantic-release-action@v4 |
| 58 | + - name: Get tag version |
57 | 59 | id: semantic_release |
58 | | - with: |
59 | | - ci: false |
60 | | - dry_run: true |
61 | | - |
| 60 | + uses: anothrNick/[email protected] |
| 61 | + env: |
| 62 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + DEFAULT_BUMP: "patch" |
| 64 | + TAG_CONTEXT: ${{ (github.base_ref != 'main') && 'branch' || 'repo' }} |
| 65 | + PRERELEASE_SUFFIX: "beta" |
| 66 | + PRERELEASE: ${{ (github.base_ref != 'main') && 'true' || 'false' }} |
| 67 | + DRY_RUN: true |
| 68 | + INITIAL_VERSION: ${{ steps.pyproject_version.outputs.TAG }} |
| 69 | + |
62 | 70 | - name: Compare versions |
63 | 71 | run: | |
64 | 72 | echo "Current version: ${{ steps.pyproject_version.outputs.TAG }}" |
65 | | - echo "New version: ${{ steps.semantic_release.outputs.new_release_version }}" |
66 | | - if [ "${{ steps.pyproject_version.outputs.TAG }}" != "${{ steps.semantic_release.outputs.new_release_version }}" ]; then |
| 73 | + echo "New version: ${{ steps.semantic_release.outputs.tag }}" |
| 74 | + if [ "${{ steps.pyproject_version.outputs.TAG }}" != "${{ steps.semantic_release.outputs.tag }}" ]; then |
67 | 75 | echo "### Version mismatch detected! :warning: |
68 | | - Current version: ${{ steps.pyproject_version.outputs.TAG }} |
69 | | - New version: **${{ steps.semantic_release.outputs.new_release_version }}** |
| 76 | + Current pyproject version: ${{ steps.pyproject_version.outputs.TAG }} |
| 77 | + New Tag version: **${{ steps.semantic_release.outputs.tag }}** |
| 78 | + Current Tag: ${{ steps.semantic_release.outputs.old_tag }} |
70 | 79 | Please update the version in pyproject.toml." >> $GITHUB_STEP_SUMMARY |
71 | 80 | exit 1 |
72 | 81 | else |
73 | 82 | echo "### Version match confirmed! :rocket: |
74 | | - Current version: ${{ steps.pyproject_version.outputs.TAG }} |
75 | | - New version: **${{ steps.semantic_release.outputs.new_release_version }}** |
| 83 | + Current pyproject version: ${{ steps.pyproject_version.outputs.TAG }} |
| 84 | + New Tag version: **${{ steps.semantic_release.outputs.tag }}** |
76 | 85 | The version is up-to-date." >> $GITHUB_STEP_SUMMARY |
77 | 86 | fi |
0 commit comments