Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7 fix deployment workflow when using manual dispatch #8

Merged
merged 18 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 )
svenpruefer marked this conversation as resolved.
Show resolved Hide resolved
uses: ./.github/workflows/queasars_deploy_documentation.yml