-
Notifications
You must be signed in to change notification settings - Fork 209
SC-89340 | Add ability to deploy demos manually #1356
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
Merged
Alan-eMartin
merged 8 commits into
sc-85409-v-demos-are-built-on-pull-request
from
sc-89340-create-a-workflow-that-can-build-and-deploy-all
Apr 29, 2025
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
aa8e2e2
add workflow
Alan-eMartin 125bc32
Update .github/workflows/v2-build-and-deploy
Alan-eMartin 5abeecd
Rename
Alan-eMartin 6a236fc
Merge remote-tracking branch 'origin/sc-89340-create-a-workflow-that-…
Alan-eMartin 448315b
add manual deploy workflow.
Alan-eMartin c1428b2
add validation and preventative steps, fix descripts
Alan-eMartin 64fb009
add better desc
Alan-eMartin ea7698b
Update .github/workflows/v2-build-and-deploy.yml
Alan-eMartin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: V2 Build and Deploy Demos | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
description: SWC environment to deploy to | ||
options: | ||
- swc-staging | ||
- swc-prod | ||
- swc-dev | ||
required: true | ||
type: choice | ||
target: | ||
default: stable | ||
description: PennyLane version to build the demos. Either 'latest' or the most recent 'stable' release. | ||
options: | ||
- latest | ||
- stable | ||
required: true | ||
type: choice | ||
demos: | ||
description: Demos to build and deploy, space-separated list of slugs (e.g. "demo1 demo2 demo3"), or leave empty for all demos. | ||
required: false | ||
type: string | ||
as-previews: | ||
default: false | ||
description: | | ||
Whether to deploy the demos as previews. | ||
|
||
**Please note** that demos built with the latest version cannot be published to swc-staging or swc-prod. | ||
They can only be deployed as previews. | ||
required: false | ||
type: boolean | ||
|
||
jobs: | ||
validate-and-parse-inputs: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
branch: ${{ steps.set-branch.outputs.branch }} | ||
steps: | ||
- name: Set branch | ||
id: set-branch | ||
run: | | ||
if [[ "${{ github.event.inputs.target }}" == "stable" ]]; then | ||
echo "branch=master" >> $GITHUB_OUTPUT | ||
elif [[ "${{ github.event.inputs.target }}" == "latest" ]]; then | ||
echo "branch=dev" >> $GITHUB_OUTPUT | ||
else | ||
echo "branch=" >> $GITHUB_OUTPUT | ||
fi | ||
doctorperceptron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Validate preview input | ||
id: validate-preview | ||
run: | | ||
if [[ | ||
("${{ github.event.inputs.environment }}" == "swc-staging" || | ||
"${{ github.event.inputs.environment }}" == "swc-prod") && | ||
"${{ github.event.inputs.target }}" == "latest" && | ||
"${{ github.event.inputs.as-previews }}" == "false" | ||
]]; then | ||
echo "=========================" | ||
echo "🚫 Invalid input detected:" | ||
echo "Demos built with the latest version cannot be published to 'swc-staging' or 'swc-prod'." | ||
echo "They can only be deployed as previews." | ||
echo "Please set the 'as-previews' input to 'true' in your workflow configuration." | ||
echo "=========================" | ||
exit 1 | ||
fi | ||
Alan-eMartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
build: | ||
needs: validate-and-parse-inputs | ||
if: > | ||
(needs.validate-and-parse-inputs.outputs.branch == 'master') || | ||
(needs.validate-and-parse-inputs.outputs.branch == 'dev') | ||
uses: ./.github/workflows/v2-build-demos.yml | ||
with: | ||
ref: github.event.inputs.target | ||
Alan-eMartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
demo-names: ${{ github.event.inputs.demos }} | ||
dev: ${{ github.event.inputs.target == 'latest' }} | ||
save-artifact: true | ||
artifact-name: build-and-deploy-${{ github.event.inputs.target }} | ||
keep-going: false | ||
quiet: false | ||
batch_size: 10 | ||
|
||
deploy: | ||
uses: ./.github/workflows/v2-deploy-demos.yml | ||
needs: | ||
- validate-and-parse-inputs | ||
- build | ||
secrets: inherit | ||
with: | ||
environment: ${{ github.event.inputs.environment }} | ||
artifact-name: build-and-deploy-${{ github.event.inputs.target }} | ||
preview: ${{ github.event.inputs.as-previews }} | ||
branch: ${{ needs.validate-and-parse-inputs.outputs.branch }} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.