Skip to content

Commit

Permalink
7 fix deployment workflow when using manual dispatch (#8)
Browse files Browse the repository at this point in the history
fix issues when manually dispatching the deployment workflow
  • Loading branch information
dleidreiter authored Nov 27, 2023
1 parent e417449 commit eef6c59
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/queasars_deploy_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ jobs:
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi "PYPI_TOKEN"
poetry publish -r pypi --build
poetry config pypi-token.pypi "$PYPI_TOKEN"
poetry publish --build
24 changes: 15 additions & 9 deletions .github/workflows/queasars_deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Version of the release in the form: vX.Y.Z'
description: 'Release version in the form: vX.Y.Z'
type: string
required: true
deploy_to_pypi:
description: 'Boolean value indicating whether QUEASARS should be deployed to PyPI.'
description: 'Deploy to PyPI.'
type: boolean
required: false
default: true
deploy_to_pages:
description: 'Boolean value indicating whether QUEASARS documentation should be deployed to GitHub Pages.'
description: 'Deploy to GitHub Pages.'
type: boolean
required: false
default: true
Expand All @@ -36,13 +36,15 @@ jobs:
name: Check Version Consistency
runs-on: ubuntu-latest
steps:
- if: ${{ inputs.version != '' }}
- if: ${{ github.event_name == 'workflow_dispatch' }}
name: Check workflow version input
shell: bash
env:
VERSION_INPUT: ${{ inputs.version }}
run: |
if [[ $inputs.version != @(v[0-9].[0-9].[0-9]) ]]; then exit 1; fi
echo "VERSION=${inputs.version:1}" >> $GITHUB_ENV
- if: ${{ inputs.version == '' }}
if [[ $VERSION_INPUT != @(v[0-9].[0-9].[0-9]) ]]; then exit 1; fi
echo "VERSION=${VERSION_INPUT:1}" >> $GITHUB_ENV
- if: ${{ github.event_name == 'push' }}
name: Get tag version
shell: bash
env:
Expand Down Expand Up @@ -82,13 +84,17 @@ jobs:
# Only deploy to PyPI if both the project version is consistent and the CI is run successfully.
name: Deploy to PyPI
needs: [Check_Version_Consistency, Run_CI]
if: ${{ inputs.deploy_to_pypi == '' || inputs.deploy_to_pypi == true }}
if: ${{ github.event_name == 'push' || inputs.deploy_to_pypi }}
uses: ./.github/workflows/queasars_deploy_to_pypi.yml
secrets: inherit

Deploy_Documentation:
# Only deploy to GitHub Pages if the deployment to PyPI succeeded.
name: Deploy to Github Pages
needs: Deploy_To_PyPI
if: ${{ inputs.deploy_to_pages == '' || inputs.deploy_to_pages == true }}
if: |
always() &&
!cancelled() &&
!failure() &&
( github.event_name == 'push' || inputs.deploy_to_pages )
uses: ./.github/workflows/queasars_deploy_documentation.yml

0 comments on commit eef6c59

Please sign in to comment.