Skip to content
Open
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
39 changes: 39 additions & 0 deletions .github/workflows/deployments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ on:
description: Build and include macOS wheels and installer.
required: false
default: true
run_publishing_after:
type: boolean
description: When this deployment completes successfully, automatically trigger the Publishing workflow.
required: false
default: false
workflow_run:
workflows:
- PR merged
Expand Down Expand Up @@ -162,6 +167,17 @@ jobs:
retention-days: 30
if-no-files-found: error

- name: Upload publishing flag
if: github.event_name == 'workflow_dispatch'
run: echo '${{ inputs.run_publishing_after }}' > publishing_requested.txt
- name: Upload publishing_requested artifact
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: publishing_requested
path: publishing_requested.txt
retention-days: 1

- name: Checkout repository
uses: actions/checkout@v6
with:
Expand Down Expand Up @@ -825,3 +841,26 @@ jobs:
with:
cache_base: ${{ needs.metadata.outputs.cache_base }}
cudaq_version: ${{ inputs.create_release }}

trigger_publishing:
name: Trigger Publishing
needs: [summary, python_wheels, binaries]
if: inputs.run_publishing_after
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Trigger Publishing workflow
uses: actions/github-script@v7
with:
github-token: ${{ secrets.REPO_BOT_ACCESS_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'publishing.yml',
ref: context.ref.replace('refs/heads/', ''),
inputs: {
deployment_id: context.runId.toString(),
},
});
32 changes: 31 additions & 1 deletion .github/workflows/publishing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,39 @@ on:
name: Publishing

jobs:
check_publishing_requested:
name: Check if publishing was requested
runs-on: ubuntu-latest
permissions:
actions: read
outputs:
run_publishing: ${{ steps.check.outputs.run_publishing }}
steps:
- id: check
run: |
if [ "${{ github.event_name }}" != "workflow_run" ]; then
echo "run_publishing=true" >> $GITHUB_OUTPUT
else
artifacts_url='${{ github.event.workflow_run.artifacts_url }}'
artifact_url=$(gh api "$artifacts_url" --paginate -q '.artifacts[] | select(.name=="publishing_requested") | .archive_download_url' | head -1)
if [ -n "$artifact_url" ]; then
gh api "$artifact_url" -o publishing_requested.zip
unzip -o publishing_requested.zip
content=$(cat publishing_requested.txt 2>/dev/null | tr -d '\n' || echo "true")
else
content="true"
fi
echo "run_publishing=$content" >> $GITHUB_OUTPUT
fi
env:
GH_TOKEN: ${{ github.token }}

assets:
name: Assets
if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
needs: [check_publishing_requested]
if: >-
(github.event_name == 'workflow_dispatch' || (github.event.workflow_run.conclusion == 'success'
&& needs.check_publishing_requested.outputs.run_publishing == 'true'))
runs-on: ubuntu-latest
permissions:
actions: read
Expand Down
Loading