-
Notifications
You must be signed in to change notification settings - Fork 2.1k
chore(websites): Setup preview site workflows #18924
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
Changes from 6 commits
c4a083c
e2de3d3
4c242bf
904af25
51b24e5
eda2588
610d353
a671681
ab48faa
36c5fbf
07578a1
0151918
8577084
22eb7cf
df636b9
38d47af
2a47dd9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| name: Deploy Vector Preview Sites | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: ["Call Preview Build"] | ||
| types: | ||
| - completed | ||
|
|
||
| jobs: | ||
| deploy_vecotr_preview_site: | ||
| uses: ./.github/workflows/create_preview_sites.yml@master | ||
| with: | ||
| APP_ID: "d1a7j77663uxsc" | ||
| APP_NAME: "vector.dev" | ||
|
|
||
| deploy_rust_doc_preview_site: | ||
| uses: ./.github/workflows/create_preview_sites.yml@master | ||
| with: | ||
| APP_ID: "d1hoyoksbulg25" | ||
| APP_NAME: "Rust Doc" | ||
|
|
||
| deploy_vrl_playground_preview_site: | ||
| uses: ./.github/workflows/create_preview_sites.yml@master | ||
| with: | ||
| APP_ID: "d2lr4eds605rpz" | ||
| APP_NAME: "VRL Playground" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: Create Preview Sites | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| APP_ID: | ||
| description: "App ID for the associated website" | ||
| required: true | ||
| type: string | ||
| APP_NAME: | ||
| description: "Application name for the comment" | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| create_preview_site: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Deploy Site | ||
| run: | | ||
| RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST \ | ||
| -H "Content-Type: application/json" \ | ||
| -H "X-Hub-Signature: $SIGNATURE" \ | ||
| -d "{\"app_id\": \"$APP_ID\", \"branch_name\": \"${{ github.head_ref }}\"}" \ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will |
||
| "$ENDPOINT") | ||
|
|
||
| # check the response code and fail if not 200 | ||
| if [ "$RESPONSE_CODE" != "200" ]; then | ||
| echo "Request failed with response code $RESPONSE_CODE" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Add preview link to comment if all 3 sites successfully start | ||
| - name: Comment Preview Link | ||
| if: success() | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| URLIZED_BRANCH=$(echo "${{ github.head_ref }}" | tr './' '--') | ||
|
|
||
| COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, I don't know that |
||
| COMMENT_CONTENT="Your preview site for the **$APP_NAME** will be ready in a few minutes, please allow time for it to build. \n \n Here's your link: \n [$APP_NAME preview](https://$URLIZED_BRANCH.$APP_ID.amplifyapp.com)" | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| name: Call Build Preview | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, syncronize] | ||
|
|
||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - run: echo "Workflow has been allowed to run for PR ${{ github.event.number }}" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.