From 185ac915eb701d15bcb2338ad63ca81366f4ce16 Mon Sep 17 00:00:00 2001 From: John Andersen Date: Tue, 21 Mar 2023 08:18:03 -0700 Subject: [PATCH] ci: release: Workaround for secrets not available in conditionals Related: https://github.com/actions/runner/issues/520 Related: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ --- .github/workflows/release.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 452feaf..9d29230 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,11 +24,19 @@ jobs: - name: Build Package run: | python -m build + - name: Get tag + id: get-tag + run: | + echo "tag=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT + if [ "x${{ secrets.PYPI_RPMFILE }}" == "x" ]; then + echo "has_pypi_token=no" >> $GITHUB_OUTPUT + else + echo "has_pypi_token=yes" >> $GITHUB_OUTPUT + fi - name: PyPi Release id: pypi-release - if: ${{ secrets.PYPI_RPMFILE != '' }} + if: ${{ steps.get-tag.outputs.has_pypi_token == 'yes' }} run: | - echo "::set-output name=tag::${GITHUB_REF/refs\/tags\//}" export TWINE_USERNAME=__token__ export TWINE_PASSWORD=${{ secrets.PYPI_RPMFILE }} python -m twine upload dist/* @@ -36,7 +44,7 @@ jobs: uses: "marvinpinto/action-automatic-releases@4edd7a5aabb1bc62e6dc99b3302d587bf3134e20" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "${{ steps.pypi-release.outputs.tag }}" + automatic_release_tag: "${{ steps.get-tag.outputs.tag }}" prerelease: false title: "${{ steps.pypi-release.outputs.tag }}" files: |