-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
chore(websites): Setup preview site workflows #18924
Changes from 1 commit
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,53 @@ | ||
name: Deploy VRL Playground Preview Site | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened] | ||
|
||
jobs: | ||
deploy_preview_site: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
||
# Create the HMAC key | ||
- name: Start Amplify Build | ||
id: hmac_runner | ||
env: | ||
REQUEST_TOKEN: ${{ secrets.REQUEST_TOKEN }} | ||
REQUEST_MESSAGE: ${{ secrets.REQUEST_MESSAGE }} | ||
ENDPOINT: ${{ secrets.BUILDER_ENDPOINT }} | ||
run: | | ||
HMAC_KEY=$(echo -n $REQUEST_MESSAGE | openssl dgst -sha256 -hmac "$REQUEST_TOKEN" -binary | od -An -tx1 | tr -d ' \n'; echo) | ||
SIGNATURE="sha256=$HMAC_KEY" | ||
|
||
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\": \"d2lr4eds605rpz\", \"branch_name\": \"${{ github.head_ref }}\"}" \ | ||
Check failure Code scanning / check-spelling Unrecognized Spelling Error
rpz is not a recognized word. (unrecognized-spelling)
|
||
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. Nit: we could pull up the |
||
"$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 | ||
- name: Comment Preview Link | ||
if: success() | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
URLIZED_BRANCH=$(echo "${{ github.head_ref }}" | tr './' '--') | ||
Check failure Code scanning / check-spelling Unrecognized Spelling Error
URLIZED is not a recognized word. (unrecognized-spelling)
|
||
COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" | ||
COMMENT_CONTENT="Your preview site for the **Vector VRL Playground** will be ready in a few minutes, please allow time for it to build. \n \n Here's your [preview link](https://$URLIZED_BRANCH.d2lr4eds605rpz.amplifyapp.com)." | ||
Check failure Code scanning / check-spelling Unrecognized Spelling Error
amplifyapp is not a recognized word. (unrecognized-spelling)
Check failure Code scanning / check-spelling Unrecognized Spelling Error
rpz is not a recognized word. (unrecognized-spelling)
Check failure Code scanning / check-spelling Unrecognized Spelling Error
URLIZED is not a recognized word. (unrecognized-spelling)
|
||
|
||
curl -sSL \ | ||
-H "Authorization: token $GITHUB_TOKEN" \ | ||
-H "Content-Type: application/json" \ | ||
-X POST \ | ||
-d "{\"body\": \"$COMMENT_CONTENT\"}" \ | ||
$COMMENT_URL |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Deploy Rust Doc Preview Site | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened] | ||
|
||
jobs: | ||
deploy_preview_site: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
||
# Create the HMAC key | ||
- name: Start Amplify Build | ||
id: hmac_runner | ||
env: | ||
REQUEST_TOKEN: ${{ secrets.REQUEST_TOKEN }} | ||
REQUEST_MESSAGE: ${{ secrets.REQUEST_MESSAGE }} | ||
ENDPOINT: ${{ secrets.BUILDER_ENDPOINT }} | ||
run: | | ||
HMAC_KEY=$(echo -n $REQUEST_MESSAGE | openssl dgst -sha256 -hmac "$REQUEST_TOKEN" -binary | od -An -tx1 | tr -d ' \n'; echo) | ||
SIGNATURE="sha256=$HMAC_KEY" | ||
|
||
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\": \"d1hoyoksbulg25\", \"branch_name\": \"${{ github.head_ref }}\"}" \ | ||
Check failure Code scanning / check-spelling Unrecognized Spelling Error
hoyoksbulg is not a recognized word. (unrecognized-spelling)
|
||
"$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 | ||
- name: Comment Preview Link | ||
if: success() | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
URLIZED_BRANCH=$(echo "${{ github.head_ref }}" | tr './' '--') | ||
Check failure Code scanning / check-spelling Unrecognized Spelling Error
URLIZED is not a recognized word. (unrecognized-spelling)
|
||
COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" | ||
COMMENT_CONTENT="Your preview site for the **Vector Rust Doc** will be ready in a few minutes, please allow time for it to build. \n \n Here's your [preview link](https://$URLIZED_BRANCH.d1hoyoksbulg25.amplifyapp.com)." | ||
Check failure Code scanning / check-spelling Unrecognized Spelling Error
hoyoksbulg is not a recognized word. (unrecognized-spelling)
Check failure Code scanning / check-spelling Unrecognized Spelling Error
URLIZED is not a recognized word. (unrecognized-spelling)
Check failure Code scanning / check-spelling Unrecognized Spelling Error
amplifyapp is not a recognized word. (unrecognized-spelling)
|
||
|
||
curl -sSL \ | ||
-H "Authorization: token $GITHUB_TOKEN" \ | ||
-H "Content-Type: application/json" \ | ||
-X POST \ | ||
-d "{\"body\": \"$COMMENT_CONTENT\"}" \ | ||
$COMMENT_URL |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Deploy Vector Website Preview Site | ||
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. Not a big deal, but given these workflows are almost identical, we could create just one parameterized workflow and call it from each of these site-specific workflows. See https://docs.github.com/en/actions/using-workflows/reusing-workflows |
||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened] | ||
|
||
jobs: | ||
deploy_preview_site: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
||
# Create the HMAC key | ||
- name: Start Amplify Build | ||
id: hmac_runner | ||
env: | ||
REQUEST_TOKEN: ${{ secrets.REQUEST_TOKEN }} | ||
REQUEST_MESSAGE: ${{ secrets.REQUEST_MESSAGE }} | ||
ENDPOINT: ${{ secrets.BUILDER_ENDPOINT }} | ||
run: | | ||
HMAC_KEY=$(echo -n $REQUEST_MESSAGE | openssl dgst -sha256 -hmac "$REQUEST_TOKEN" -binary | od -An -tx1 | tr -d ' \n'; echo) | ||
SIGNATURE="sha256=$HMAC_KEY" | ||
|
||
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\": \"d1a7j77663uxsc\", \"branch_name\": \"${{ github.head_ref }}\"}" \ | ||
Check failure Code scanning / check-spelling Unrecognized Spelling Error
uxsc is not a recognized word. (unrecognized-spelling)
|
||
"$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 | ||
- name: Comment Preview Link | ||
if: success() | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
URLIZED_BRANCH=$(echo "${{ github.head_ref }}" | tr './' '--') | ||
Check failure Code scanning / check-spelling Unrecognized Spelling Error
URLIZED is not a recognized word. (unrecognized-spelling)
|
||
COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" | ||
COMMENT_CONTENT="Your preview site for the **Vector Website** will be ready in a few minutes, please allow time for it to build. \n \n Here's your [preview link](https://$URLIZED_BRANCH.d2lr4eds605rpz.amplifyapp.com)." | ||
Check failure Code scanning / check-spelling Unrecognized Spelling Error
rpz is not a recognized word. (unrecognized-spelling)
Check failure Code scanning / check-spelling Unrecognized Spelling Error
amplifyapp is not a recognized word. (unrecognized-spelling)
|
||
|
||
curl -sSL \ | ||
-H "Authorization: token $GITHUB_TOKEN" \ | ||
-H "Content-Type: application/json" \ | ||
-X POST \ | ||
-d "{\"body\": \"$COMMENT_CONTENT\"}" \ | ||
$COMMENT_URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given these workflows need access to secrets, I think they need to be
on
pull_request_target
instead ofpull_request
.