From 87b8a4b3cba82b54c191e1e03e862c2ae478701b Mon Sep 17 00:00:00 2001 From: Fabio Berta Date: Fri, 27 Oct 2023 17:25:02 +0200 Subject: [PATCH] Fix pushing tag to origin Using broad `git push --tags` led to a permission denied error. Pushing only the specific tag should work though. --- .github/workflows/publish-test.yml | 2 +- .github/workflows/publish.yml | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-test.yml index adb34658..0ff3320e 100644 --- a/.github/workflows/publish-test.yml +++ b/.github/workflows/publish-test.yml @@ -24,7 +24,7 @@ jobs: run: | python -m pip install --upgrade pip pip install tox tox-gh-actions - - name: Add version tag + - name: Tag commit with version env: VERSION: ${{ inputs.version }} run: git tag v$VERSION diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f3f7e252..de45bf5a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -42,10 +42,15 @@ jobs: run: | python -m pip install --upgrade pip pip install tox tox-gh-actions - - name: Add version tag + - name: Build version tag + id: build-version-tag run: | VERSION=$(echo "$GITHUB_HEAD_REF" | sed 's/release\///') - git tag v"$VERSION" + echo "{VERSION_TAG}={v$VERSION}" >> "$GITHUB_OUTPUT" + - name: Tag commit with version + env: + VERSION_TAG: ${{ steps.build-version-tag.outputs.VERSION_TAG }} + run: git tag "$VERSION_TAG" - name: Build new package run: tox run -e build - name: Publish package to PyPI @@ -53,7 +58,9 @@ jobs: with: password: ${{ secrets.PYPI_API_TOKEN }} - name: Push version tag - run: git push --tags + env: + VERSION_TAG: ${{ steps.build-version-tag.outputs.VERSION_TAG }} + run: git push origin "$VERSION_TAG" - name: Archive package uses: actions/upload-artifact@v3 with: