Skip to content
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
6 changes: 6 additions & 0 deletions .github/workflows/build_preview_sites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,30 @@ jobs:
with:
APP_ID: "d1a7j77663uxsc"
APP_NAME: "vector.dev"
secrets:
REQUEST_TOKEN: ${{ secrets.REQUEST_TOKEN }}
REQUEST_MESSAGE: ${{ secrets.REQUEST_MESSAGE }}
ENDPOINT: ${{ secrets.BUILDER_ENDPOINT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

deploy_rust_doc_preview_site:
uses: ./.github/workflows/create_preview_sites.yml
with:
APP_ID: "d1hoyoksbulg25"
APP_NAME: "Rust Doc"
secrets:
REQUEST_TOKEN: ${{ secrets.REQUEST_TOKEN }}
REQUEST_MESSAGE: ${{ secrets.REQUEST_MESSAGE }}
ENDPOINT: ${{ secrets.BUILDER_ENDPOINT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

deploy_vrl_playground_preview_site:
uses: ./.github/workflows/create_preview_sites.yml
with:
APP_ID: "d2lr4eds605rpz"
APP_NAME: "VRL Playground"
secrets:
REQUEST_TOKEN: ${{ secrets.REQUEST_TOKEN }}
REQUEST_MESSAGE: ${{ secrets.REQUEST_MESSAGE }}
ENDPOINT: ${{ secrets.BUILDER_ENDPOINT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 14 additions & 4 deletions .github/workflows/create_preview_sites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@ on:
description: "Application name for the comment"
required: true
type: string
secrets:
REQUEST_TOKEN:
description: "Token for the request"
required: true
type: secret
REQUEST_MESSAGE:
description: "Message for the request"
required: true
type: secret
ENDPOINT:
description: "Request endpoint"
required: true
type: secret
GITHUB_TOKEN:
description: "GitHub Token"
required: true

jobs:
create_preview_site:
Expand Down Expand Up @@ -59,6 +60,12 @@ jobs:

# Kick off the job in amplify
- name: Deploy Site
env:
APP_ID: ${{ inputs.APP_ID }}
APP_NAME: ${{ inputs.APP_NAME }}
REQUEST_TOKEN: ${{ secrets.REQUEST_TOKEN }}
REQUEST_MESSAGE: ${{ secrets.REQUEST_MESSAGE }}
ENDPOINT: ${{ secrets.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"
Expand All @@ -79,16 +86,19 @@ jobs:
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APP_ID: ${{ inputs.APP_ID }}
APP_NAME: ${{ inputs.APP_NAME }}
uses: actions/github-script@v6.4.1
with:
script: |
const fs = require('fs');
const prNumber = fs.readFileSync('./pr/number', 'utf8');
const issueNumber = parseInt(prNumber);

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
issue_number: issueNumber,
body: `Your preview site for the **${APP_NAME}** will be ready in a few minutes, please allow time for it to build. \n \n Heres your preview link: \n [${APP_NAME} preview](https://${SANITIZED_BRANCH_NAME}.${APP_ID}.amplifyapp.com)`
});

Expand Down