From 51b82606b01694053328a240adf3de3f498e25ae Mon Sep 17 00:00:00 2001 From: "paul.profizi" Date: Thu, 14 Dec 2023 18:28:50 +0100 Subject: [PATCH] Fix releaser.yml Signed-off-by: paul.profizi --- .github/workflows/ansys_lab.yml | 6 +++--- .github/workflows/releaser.yml | 26 ++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ansys_lab.yml b/.github/workflows/ansys_lab.yml index 1d66c6383f..65c301d79b 100644 --- a/.github/workflows/ansys_lab.yml +++ b/.github/workflows/ansys_lab.yml @@ -5,14 +5,14 @@ on: workflow_call: inputs: version: - description: "Release version as 'X.Y.Z'" + description: "Release version as 'vX.Y.Z'" type: string required: true # Can be called manually workflow_dispatch: inputs: version: - description: "Release version as 'X.Y.Z'" + description: "Release version as 'vX.Y.Z'" type: string required: true @@ -43,7 +43,7 @@ jobs: with: file: HTML-doc-ansys-dpf-core.zip token: ${{ secrets.GITHUB_TOKEN }} - version: tags/v${{ inputs.version }} + version: tags/${{ inputs.version }} - name: "Extract ipynb examples" shell: python diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index dc2946c34d..6fbd86620a 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -22,14 +22,34 @@ env: jobs: + get_latest_tag: + name: "Get latest release version tag" + runs-on: ubuntu-latest + outputs: + version: ${{ steps.step1.outputs.version }} + steps: + - id: step1 + name: "Get version tag" + shell: bash + run: | + get_latest_release() { + curl --silent "https://api.github.com/repos/$1/releases/latest" | + grep '"tag_name":' | + sed -E 's/.*"([^"]+)".*/\1/' + } + version=$(get_latest_release "ansys/pydpf-core") + echo $version + echo "version=$version" >> "$GITHUB_OUTPUT" + Publish_to_PyPI: name: "Publish Release to PyPI" runs-on: ubuntu-latest + needs: get_latest_tag steps: - name: "Download Release Assets" uses: robinraju/release-downloader@v1.8 with: - tag: ${{ github.event.inputs.release_tag || 'latest' }} + tag: ${{ github.event.inputs.release_tag || needs.get_latest_tag.outputs.version }} fileName: "*.whl" tarBall: false zipBall: false @@ -55,6 +75,7 @@ jobs: with: file: HTML-doc-ansys-dpf-core.zip token: ${{ secrets.GITHUB_TOKEN }} + version: tags/${{ github.event.inputs.release_tag || needs.get_latest_tag.outputs.version }} - name: "List downloaded assets" shell: bash @@ -111,6 +132,7 @@ jobs: update_ansys_lab_examples: uses: ./.github/workflows/ansys_lab.yml + needs: get_latest_tag with: - version: ${{ github.event.inputs.release_tag || 'latest' }} + version: ${{ github.event.inputs.release_tag || needs.get_latest_tag.outputs.version }} secrets: inherit