From c4a083c9e19328955eba50d7cf838bad85590e25 Mon Sep 17 00:00:00 2001 From: Devin Ford Date: Tue, 24 Oct 2023 11:01:06 -0400 Subject: [PATCH 01/16] feat: add new preview site workflows --- .../workflows/build_playground_preview.yml | 53 +++++++++++++++++++ .github/workflows/build_rustdoc_preview.yml | 53 +++++++++++++++++++ .github/workflows/build_website_preview.yml | 53 +++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 .github/workflows/build_playground_preview.yml create mode 100644 .github/workflows/build_rustdoc_preview.yml create mode 100644 .github/workflows/build_website_preview.yml diff --git a/.github/workflows/build_playground_preview.yml b/.github/workflows/build_playground_preview.yml new file mode 100644 index 0000000000000..e9bac6f9200ab --- /dev/null +++ b/.github/workflows/build_playground_preview.yml @@ -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 }}\"}" \ + "$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 './' '--') + 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)." + + curl -sSL \ + -H "Authorization: token $GITHUB_TOKEN" \ + -H "Content-Type: application/json" \ + -X POST \ + -d "{\"body\": \"$COMMENT_CONTENT\"}" \ + $COMMENT_URL diff --git a/.github/workflows/build_rustdoc_preview.yml b/.github/workflows/build_rustdoc_preview.yml new file mode 100644 index 0000000000000..d1bf5b3577b04 --- /dev/null +++ b/.github/workflows/build_rustdoc_preview.yml @@ -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 }}\"}" \ + "$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 './' '--') + 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)." + + curl -sSL \ + -H "Authorization: token $GITHUB_TOKEN" \ + -H "Content-Type: application/json" \ + -X POST \ + -d "{\"body\": \"$COMMENT_CONTENT\"}" \ + $COMMENT_URL diff --git a/.github/workflows/build_website_preview.yml b/.github/workflows/build_website_preview.yml new file mode 100644 index 0000000000000..fa6a85d9beb6b --- /dev/null +++ b/.github/workflows/build_website_preview.yml @@ -0,0 +1,53 @@ +name: Deploy Vector Website 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\": \"d1a7j77663uxsc\", \"branch_name\": \"${{ github.head_ref }}\"}" \ + "$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 './' '--') + 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)." + + curl -sSL \ + -H "Authorization: token $GITHUB_TOKEN" \ + -H "Content-Type: application/json" \ + -X POST \ + -d "{\"body\": \"$COMMENT_CONTENT\"}" \ + $COMMENT_URL From e2de3d39d67c696ea7a300ef53995ee1e119ee4c Mon Sep 17 00:00:00 2001 From: Devin Ford Date: Wed, 25 Oct 2023 13:03:36 -0400 Subject: [PATCH 02/16] feat: combine workflows, update spellcheck to ignore file --- .github/actions/spelling/excludes.txt | 1 + .../workflows/build_playground_preview.yml | 53 ------------ .github/workflows/build_preview_sites.yml | 80 +++++++++++++++++++ .github/workflows/build_rustdoc_preview.yml | 53 ------------ .github/workflows/build_website_preview.yml | 53 ------------ 5 files changed, 81 insertions(+), 159 deletions(-) delete mode 100644 .github/workflows/build_playground_preview.yml create mode 100644 .github/workflows/build_preview_sites.yml delete mode 100644 .github/workflows/build_rustdoc_preview.yml delete mode 100644 .github/workflows/build_website_preview.yml diff --git a/.github/actions/spelling/excludes.txt b/.github/actions/spelling/excludes.txt index 18102653372a8..9a71b9739963c 100644 --- a/.github/actions/spelling/excludes.txt +++ b/.github/actions/spelling/excludes.txt @@ -3,6 +3,7 @@ (?:^|/)(?i)LICEN[CS]E (?:^|/)3rdparty/ (?:^|/)amplify\.yml$ +(?:^|/)build_preview_sites\.yml$ (?:^|/)go\.sum$ (?:^|/)package(?:-lock|)\.json$ (?:^|/)Pipfile$ diff --git a/.github/workflows/build_playground_preview.yml b/.github/workflows/build_playground_preview.yml deleted file mode 100644 index e9bac6f9200ab..0000000000000 --- a/.github/workflows/build_playground_preview.yml +++ /dev/null @@ -1,53 +0,0 @@ -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 }}\"}" \ - "$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 './' '--') - 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)." - - curl -sSL \ - -H "Authorization: token $GITHUB_TOKEN" \ - -H "Content-Type: application/json" \ - -X POST \ - -d "{\"body\": \"$COMMENT_CONTENT\"}" \ - $COMMENT_URL diff --git a/.github/workflows/build_preview_sites.yml b/.github/workflows/build_preview_sites.yml new file mode 100644 index 0000000000000..d2f70b3bbf510 --- /dev/null +++ b/.github/workflows/build_preview_sites.yml @@ -0,0 +1,80 @@ +name: Deploy Vector Website Preview Sites + +on: + pull_request: + types: [opened, reopened, syncronize] + +jobs: + deploy_preview_site: + runs-on: ubuntu-latest + env: + VECTOR_WEBSITE_APP_ID: "d1a7j77663uxsc" + VECTOR_RUSTDOC_APP_ID: "d1hoyoksbulg25" + VECTOR_PLAYGROUND_APP_ID: "d2lr4eds605rpz" + + steps: + # Create the HMAC key + - name: Start Amplify Builds + 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" + + # Vector.dev + WEBSITE_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\": \"$VECTOR_WEBSITE_APP_ID\", \"branch_name\": \"${{ github.head_ref }}\"}" \ + "$ENDPOINT") + + # check the response code and fail if not 200 + if [ "$WEBSITE_RESPONSE_CODE" != "200" ]; then + echo "Request failed with response code $RESPONSE_CODE" + exit 1 + fi + + # Rust Doc + RUSTDOC_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\": \"$VECTOR_RUSTDOC_APP_ID\", \"branch_name\": \"${{ github.head_ref }}\"}" \ + "$ENDPOINT") + + # check the response code and fail if not 200 + if [ "$RUSTDOC_RESPONSE_CODE" != "200" ]; then + echo "Request failed with response code $RESPONSE_CODE" + exit 1 + fi + + # VRL Playground + PLAYGROUND_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\": \"$VECTOR_PLAYGROUND_APP_ID\", \"branch_name\": \"${{ github.head_ref }}\"}" \ + "$ENDPOINT") + + # check the response code and fail if not 200 + if [ "$WEBSITE_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" + 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 links: \n [vector.dev](https://$URLIZED_BRANCH.$VECTOR_WEBSITE_APP_ID.amplifyapp.com) \n [Rust Doc](https://$URLIZED_BRANCH.$VECTOR_RUSTDOC_APP_ID.amplifyapp.com). \n [VRL Playground](https://$URLIZED_BRANCH.$VECTOR_PLAYGROUND_APP_ID.amplifyapp.com))" + + curl -sSL \ + -H "Authorization: token $GITHUB_TOKEN" \ + -H "Content-Type: application/json" \ + -X POST \ + -d "{\"body\": \"$COMMENT_CONTENT\"}" \ + $COMMENT_URL diff --git a/.github/workflows/build_rustdoc_preview.yml b/.github/workflows/build_rustdoc_preview.yml deleted file mode 100644 index d1bf5b3577b04..0000000000000 --- a/.github/workflows/build_rustdoc_preview.yml +++ /dev/null @@ -1,53 +0,0 @@ -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 }}\"}" \ - "$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 './' '--') - 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)." - - curl -sSL \ - -H "Authorization: token $GITHUB_TOKEN" \ - -H "Content-Type: application/json" \ - -X POST \ - -d "{\"body\": \"$COMMENT_CONTENT\"}" \ - $COMMENT_URL diff --git a/.github/workflows/build_website_preview.yml b/.github/workflows/build_website_preview.yml deleted file mode 100644 index fa6a85d9beb6b..0000000000000 --- a/.github/workflows/build_website_preview.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Deploy Vector Website 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\": \"d1a7j77663uxsc\", \"branch_name\": \"${{ github.head_ref }}\"}" \ - "$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 './' '--') - 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)." - - curl -sSL \ - -H "Authorization: token $GITHUB_TOKEN" \ - -H "Content-Type: application/json" \ - -X POST \ - -d "{\"body\": \"$COMMENT_CONTENT\"}" \ - $COMMENT_URL From 4c242bf988cadf56bb14f0e1a9a0b3d519b56766 Mon Sep 17 00:00:00 2001 From: Devin Ford Date: Wed, 25 Oct 2023 13:52:54 -0400 Subject: [PATCH 03/16] feat: make reusable workflow --- .github/workflows/build_preview_sites.yml | 92 +++++----------------- .github/workflows/create_preview_sites.yml | 43 ++++++++++ 2 files changed, 61 insertions(+), 74 deletions(-) create mode 100644 .github/workflows/create_preview_sites.yml diff --git a/.github/workflows/build_preview_sites.yml b/.github/workflows/build_preview_sites.yml index d2f70b3bbf510..212c1fccbc6fb 100644 --- a/.github/workflows/build_preview_sites.yml +++ b/.github/workflows/build_preview_sites.yml @@ -1,80 +1,24 @@ -name: Deploy Vector Website Preview Sites +name: Deploy Vector Preview Sites on: pull_request: types: [opened, reopened, syncronize] jobs: - deploy_preview_site: - runs-on: ubuntu-latest - env: - VECTOR_WEBSITE_APP_ID: "d1a7j77663uxsc" - VECTOR_RUSTDOC_APP_ID: "d1hoyoksbulg25" - VECTOR_PLAYGROUND_APP_ID: "d2lr4eds605rpz" - - steps: - # Create the HMAC key - - name: Start Amplify Builds - 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" - - # Vector.dev - WEBSITE_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\": \"$VECTOR_WEBSITE_APP_ID\", \"branch_name\": \"${{ github.head_ref }}\"}" \ - "$ENDPOINT") - - # check the response code and fail if not 200 - if [ "$WEBSITE_RESPONSE_CODE" != "200" ]; then - echo "Request failed with response code $RESPONSE_CODE" - exit 1 - fi - - # Rust Doc - RUSTDOC_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\": \"$VECTOR_RUSTDOC_APP_ID\", \"branch_name\": \"${{ github.head_ref }}\"}" \ - "$ENDPOINT") - - # check the response code and fail if not 200 - if [ "$RUSTDOC_RESPONSE_CODE" != "200" ]; then - echo "Request failed with response code $RESPONSE_CODE" - exit 1 - fi - - # VRL Playground - PLAYGROUND_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\": \"$VECTOR_PLAYGROUND_APP_ID\", \"branch_name\": \"${{ github.head_ref }}\"}" \ - "$ENDPOINT") - - # check the response code and fail if not 200 - if [ "$WEBSITE_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" - 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 links: \n [vector.dev](https://$URLIZED_BRANCH.$VECTOR_WEBSITE_APP_ID.amplifyapp.com) \n [Rust Doc](https://$URLIZED_BRANCH.$VECTOR_RUSTDOC_APP_ID.amplifyapp.com). \n [VRL Playground](https://$URLIZED_BRANCH.$VECTOR_PLAYGROUND_APP_ID.amplifyapp.com))" - - curl -sSL \ - -H "Authorization: token $GITHUB_TOKEN" \ - -H "Content-Type: application/json" \ - -X POST \ - -d "{\"body\": \"$COMMENT_CONTENT\"}" \ - $COMMENT_URL + 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" diff --git a/.github/workflows/create_preview_sites.yml b/.github/workflows/create_preview_sites.yml new file mode 100644 index 0000000000000..8bf8793393479 --- /dev/null +++ b/.github/workflows/create_preview_sites.yml @@ -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 }}\"}" \ + "$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" + 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)" + + From 904af2538b068560cb3a00316c9fd029ac500e9e Mon Sep 17 00:00:00 2001 From: Devin Ford Date: Wed, 25 Oct 2023 13:55:50 -0400 Subject: [PATCH 04/16] chore: add new workflow file to spellcheck exclude --- .github/actions/spelling/excludes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/spelling/excludes.txt b/.github/actions/spelling/excludes.txt index 9a71b9739963c..4a22f91fbb855 100644 --- a/.github/actions/spelling/excludes.txt +++ b/.github/actions/spelling/excludes.txt @@ -4,6 +4,7 @@ (?:^|/)3rdparty/ (?:^|/)amplify\.yml$ (?:^|/)build_preview_sites\.yml$ +(?:^|/)create_preview_sites\.yml$ (?:^|/)go\.sum$ (?:^|/)package(?:-lock|)\.json$ (?:^|/)Pipfile$ From 51b24e56096e0dc53c5f3322cd47a9d0801c100c Mon Sep 17 00:00:00 2001 From: Devin Ford Date: Wed, 25 Oct 2023 16:23:45 -0400 Subject: [PATCH 05/16] fix: update workflow pathing --- .github/workflows/build_preview_sites.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_preview_sites.yml b/.github/workflows/build_preview_sites.yml index 212c1fccbc6fb..f2a42f377cbb9 100644 --- a/.github/workflows/build_preview_sites.yml +++ b/.github/workflows/build_preview_sites.yml @@ -6,19 +6,19 @@ on: jobs: deploy_vecotr_preview_site: - uses: .github/workflows/create_preview_sites.yml@master + 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 + 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 + uses: ./.github/workflows/create_preview_sites.yml@master with: APP_ID: "d2lr4eds605rpz" APP_NAME: "VRL Playground" From eda2588302f9cc35728dedf4d0cc8cbd37fc1769 Mon Sep 17 00:00:00 2001 From: Devin Ford Date: Fri, 27 Oct 2023 15:03:05 -0400 Subject: [PATCH 06/16] feat: update so we can run the workflow for forks on approval with the github secrets we need --- .github/workflows/build_preview_sites.yml | 6 ++++-- .github/workflows/preview_site_trigger.yml | 13 +++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/preview_site_trigger.yml diff --git a/.github/workflows/build_preview_sites.yml b/.github/workflows/build_preview_sites.yml index f2a42f377cbb9..de2266578f6c0 100644 --- a/.github/workflows/build_preview_sites.yml +++ b/.github/workflows/build_preview_sites.yml @@ -1,8 +1,10 @@ name: Deploy Vector Preview Sites on: - pull_request: - types: [opened, reopened, syncronize] + workflow_run: + workflows: ["Call Preview Build"] + types: + - completed jobs: deploy_vecotr_preview_site: diff --git a/.github/workflows/preview_site_trigger.yml b/.github/workflows/preview_site_trigger.yml new file mode 100644 index 0000000000000..8006de00a409d --- /dev/null +++ b/.github/workflows/preview_site_trigger.yml @@ -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 }}" + From 610d35395a730bd488a7ecf70dab79d5843621cb Mon Sep 17 00:00:00 2001 From: Devin Ford Date: Fri, 27 Oct 2023 15:09:39 -0400 Subject: [PATCH 07/16] fix: update excludes text for new file --- .github/actions/spelling/excludes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/spelling/excludes.txt b/.github/actions/spelling/excludes.txt index 4a22f91fbb855..9664bb68a8f9e 100644 --- a/.github/actions/spelling/excludes.txt +++ b/.github/actions/spelling/excludes.txt @@ -5,6 +5,7 @@ (?:^|/)amplify\.yml$ (?:^|/)build_preview_sites\.yml$ (?:^|/)create_preview_sites\.yml$ +(?:^|/)preview_site_trigger\.yml$ (?:^|/)go\.sum$ (?:^|/)package(?:-lock|)\.json$ (?:^|/)Pipfile$ From ab48faacb62b988cef07d29d0925e85b37019f94 Mon Sep 17 00:00:00 2001 From: Devin Ford Date: Fri, 27 Oct 2023 15:12:44 -0400 Subject: [PATCH 08/16] fix: yaml syntax --- .github/workflows/preview_site_trigger.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/preview_site_trigger.yml b/.github/workflows/preview_site_trigger.yml index 8006de00a409d..961d5c52db9ef 100644 --- a/.github/workflows/preview_site_trigger.yml +++ b/.github/workflows/preview_site_trigger.yml @@ -9,5 +9,6 @@ jobs: runs-on: ubuntu-latest steps: - - run: echo "Workflow has been allowed to run for PR ${{ github.event.number }}" + - name: Check for approval + run: echo "Workflow has been allowed to run for PR ${{ github.event.number }}" From 36c5fbfb4357bda1dd310abf8033d441ba2a9155 Mon Sep 17 00:00:00 2001 From: Devin Ford Date: Fri, 27 Oct 2023 15:14:31 -0400 Subject: [PATCH 09/16] fix: syntax --- .github/workflows/preview_site_trigger.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/preview_site_trigger.yml b/.github/workflows/preview_site_trigger.yml index 961d5c52db9ef..93fff70195dda 100644 --- a/.github/workflows/preview_site_trigger.yml +++ b/.github/workflows/preview_site_trigger.yml @@ -10,5 +10,6 @@ jobs: steps: - name: Check for approval - run: echo "Workflow has been allowed to run for PR ${{ github.event.number }}" + run: | + echo "Workflow has been allowed to run for PR ${{ github.event.number }}" From 07578a127c2519ec39ea4371083404d34f31c30f Mon Sep 17 00:00:00 2001 From: Devin Ford Date: Fri, 27 Oct 2023 15:17:22 -0400 Subject: [PATCH 10/16] fix: github yaml errors --- .github/workflows/build_preview_sites.yml | 6 +++--- .github/workflows/preview_site_trigger.yml | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_preview_sites.yml b/.github/workflows/build_preview_sites.yml index de2266578f6c0..5e11e03ac0f0e 100644 --- a/.github/workflows/build_preview_sites.yml +++ b/.github/workflows/build_preview_sites.yml @@ -8,19 +8,19 @@ on: jobs: deploy_vecotr_preview_site: - uses: ./.github/workflows/create_preview_sites.yml@master + uses: ./.github/workflows/create_preview_sites.yml with: APP_ID: "d1a7j77663uxsc" APP_NAME: "vector.dev" deploy_rust_doc_preview_site: - uses: ./.github/workflows/create_preview_sites.yml@master + uses: ./.github/workflows/create_preview_sites.yml with: APP_ID: "d1hoyoksbulg25" APP_NAME: "Rust Doc" deploy_vrl_playground_preview_site: - uses: ./.github/workflows/create_preview_sites.yml@master + uses: ./.github/workflows/create_preview_sites.yml with: APP_ID: "d2lr4eds605rpz" APP_NAME: "VRL Playground" diff --git a/.github/workflows/preview_site_trigger.yml b/.github/workflows/preview_site_trigger.yml index 93fff70195dda..cbb97c681655c 100644 --- a/.github/workflows/preview_site_trigger.yml +++ b/.github/workflows/preview_site_trigger.yml @@ -5,11 +5,10 @@ on: types: [opened, reopened, syncronize] jobs: - build: + approval_check: runs-on: ubuntu-latest - - steps: - - name: Check for approval - run: | - echo "Workflow has been allowed to run for PR ${{ github.event.number }}" + steps: + - name: Check for approval + run: | + echo "Workflow has been allowed to run for PR ${{ github.event.number }}" From 01519187518d10b96f161931392bd78a41325952 Mon Sep 17 00:00:00 2001 From: Devin Ford Date: Fri, 27 Oct 2023 15:20:16 -0400 Subject: [PATCH 11/16] fix: spelling --- .github/workflows/preview_site_trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview_site_trigger.yml b/.github/workflows/preview_site_trigger.yml index cbb97c681655c..5ee991062b29d 100644 --- a/.github/workflows/preview_site_trigger.yml +++ b/.github/workflows/preview_site_trigger.yml @@ -2,7 +2,7 @@ name: Call Build Preview on: pull_request: - types: [opened, reopened, syncronize] + types: [opened, reopened, synchronize] jobs: approval_check: From 857708450ac32aeaf78a2f43e81062c433df1958 Mon Sep 17 00:00:00 2001 From: Devin Ford Date: Fri, 27 Oct 2023 15:25:21 -0400 Subject: [PATCH 12/16] fix: file naming --- .github/workflows/build_preview_sites.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_preview_sites.yml b/.github/workflows/build_preview_sites.yml index 5e11e03ac0f0e..f1eb0c9ebab1a 100644 --- a/.github/workflows/build_preview_sites.yml +++ b/.github/workflows/build_preview_sites.yml @@ -2,7 +2,7 @@ name: Deploy Vector Preview Sites on: workflow_run: - workflows: ["Call Preview Build"] + workflows: ["Call Build Preview"] types: - completed From 22eb7cfa552c3c7d743c1da92aaeeaea6396fab6 Mon Sep 17 00:00:00 2001 From: Devin Ford Date: Fri, 27 Oct 2023 16:04:19 -0400 Subject: [PATCH 13/16] chore: remove sync from types --- .github/workflows/preview_site_trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview_site_trigger.yml b/.github/workflows/preview_site_trigger.yml index 5ee991062b29d..14fedd8f15055 100644 --- a/.github/workflows/preview_site_trigger.yml +++ b/.github/workflows/preview_site_trigger.yml @@ -2,7 +2,7 @@ name: Call Build Preview on: pull_request: - types: [opened, reopened, synchronize] + types: [opened, reopened] jobs: approval_check: From df636b9debc4c409d936094d7c20244fb8fa37c2 Mon Sep 17 00:00:00 2001 From: Devin Ford Date: Mon, 30 Oct 2023 12:37:55 -0400 Subject: [PATCH 14/16] Update .github/workflows/build_preview_sites.yml Co-authored-by: Jesse Szwedko --- .github/workflows/build_preview_sites.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_preview_sites.yml b/.github/workflows/build_preview_sites.yml index f1eb0c9ebab1a..08a1a6dfdbdee 100644 --- a/.github/workflows/build_preview_sites.yml +++ b/.github/workflows/build_preview_sites.yml @@ -7,7 +7,7 @@ on: - completed jobs: - deploy_vecotr_preview_site: + deploy_vector_preview_site: uses: ./.github/workflows/create_preview_sites.yml with: APP_ID: "d1a7j77663uxsc" From 38d47afc76b61f127c23e880c842505866c9d273 Mon Sep 17 00:00:00 2001 From: Devin Ford Date: Mon, 30 Oct 2023 18:35:17 -0400 Subject: [PATCH 15/16] feat: update workflows with artifacts, remove netlify files --- .github/workflows/create_preview_sites.yml | 41 +++++++- .github/workflows/preview_site_trigger.yml | 15 ++- lib/vector-vrl/web-playground/netlify.toml | 17 ---- netlify.toml | 109 --------------------- rust-doc/netlify.toml | 9 -- website/Brewfile.netlify | 2 - 6 files changed, 50 insertions(+), 143 deletions(-) delete mode 100644 lib/vector-vrl/web-playground/netlify.toml delete mode 100644 netlify.toml delete mode 100644 rust-doc/netlify.toml delete mode 100644 website/Brewfile.netlify diff --git a/.github/workflows/create_preview_sites.yml b/.github/workflows/create_preview_sites.yml index 8bf8793393479..f605d59e43cce 100644 --- a/.github/workflows/create_preview_sites.yml +++ b/.github/workflows/create_preview_sites.yml @@ -30,14 +30,47 @@ jobs: exit 1 fi + # Get the artifacts with the PR number and branch name + - name: Download artifact + uses: actions/github-script@v3.1.0 + with: + script: | + const fs = require('fs'); + const artifacts = await github.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{ github.event.workflow_run.id }}, + }); + const matchArtifact = artifacts.data.artifacts.filter(artifact => artifact.name == "pr")[0]; + const download = await github.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + fs.writeFileSync('${{ github.workspace }}/pr.zip', Buffer.from(download.data)); + + - run: unzip pr.zip -d pr + # 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" - 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)" + uses: actions/github-script@v3 + with: + script: | + const prInfo = fs.readFileSync('./pr/PR_INFO', 'utf8'); + const prInfoLines = prInfo.split('\n'); + const issueNumber = parseInt(prInfoLines[0].split(': ')[1]); + const branchName = prInfoLines[1].split(': ')[1]; + const SANITIZED_BRANCH_NAME = branchName.replace(/[\/\.]/g, '-') + + await github.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue_number, + 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)` + }); diff --git a/.github/workflows/preview_site_trigger.yml b/.github/workflows/preview_site_trigger.yml index 14fedd8f15055..0e313805f108d 100644 --- a/.github/workflows/preview_site_trigger.yml +++ b/.github/workflows/preview_site_trigger.yml @@ -8,7 +8,18 @@ jobs: approval_check: runs-on: ubuntu-latest steps: - - name: Check for approval + - name: Echo approval run: | - echo "Workflow has been allowed to run for PR ${{ github.event.number }}" + echo "Workflow has been allowed to run for PR ${{ github.event.number }}. Setting artifacts and then continuing workflow runs" + - name: Save PR number and Branch name + run: | + mkdir -p ./pr + echo "PR Number: ${{ github.event.number }}" > ./pr/PR_INFO + echo "Branch Name: ${{ github.head_ref }}" >> ./pr/PR_INFO + + - name: Upload PR information artifact + uses: actions/upload-artifact@v2 + with: + name: pr + path: pr/ diff --git a/lib/vector-vrl/web-playground/netlify.toml b/lib/vector-vrl/web-playground/netlify.toml deleted file mode 100644 index 824b50e04972f..0000000000000 --- a/lib/vector-vrl/web-playground/netlify.toml +++ /dev/null @@ -1,17 +0,0 @@ -# Settings in the [build] context are global and are applied to -# all contexts unless otherwise overridden by more specific contexts. -[build] - # Directory to change to before starting a build. - # This is where we will build the site in web-playground/public. - # If not set, defaults to the root directory. - base = "lib/vector-vrl/web-playground/" - - # Directory that contains the deploy-ready HTML files and - # assets generated by the build. - publish = "public/" - - # Default build command. - command = "bash ../../../scripts/ensure-wasm-pack-installed.sh && wasm-pack build --target web --out-dir public/pkg" - - # Ignore everything except the base directory and changes to vector/lib/ - ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../../../lib" diff --git a/netlify.toml b/netlify.toml deleted file mode 100644 index bcf59eb205b40..0000000000000 --- a/netlify.toml +++ /dev/null @@ -1,109 +0,0 @@ -[build] -base = "website" -publish = "public" - -# Reinstate this when we figure out how to target this better -#ignore = "./scripts/build-ignore.sh" - -[build.environment] -HUGO_VERSION = "0.84.0" -ALGOLIA_INDEX_FILE="public/search.json" - -[context.production] -command = "make ci-production-build" - -[context.production.environment] -ALGOLIA_INDEX_NAME="vector_docs_prod" - -[context.deploy-preview] -command = "make ci-preview-build" - -[context.deploy-preview.environment] -ALGOLIA_INDEX_NAME="vector_docs_staging" - -[context.branch-deploy] -command = "make ci-preview-build" - -[context.branch-deploy.environment] -ALGOLIA_INDEX_NAME="vector_docs_staging" - -# Subdomain redirects -[[redirects]] -from = "https://vector-project.netlify.com/*" -to = "https://vector.dev/:splat" -status = 301 -force = true - -[[redirects]] -from = "https://calendar.vector.dev/*" -to = "https://calendar.google.com/calendar/embed?src=c_qsq1nrsgetsspkn7pjrqh6cclc%40group.calendar.google.com&ctz=America%2FNew_York" -status = 302 -force = true - -[[redirects]] -from = "https://chat.vector.dev/*" -to = "https://discord.gg/ptvgXhUF2m" -status = 302 -force = true - -[[redirects]] -from = "https://discussions.vector.dev/*" -to = "https://github.com/vectordotdev/vector/discussions" -status = 302 -force = true - -[[redirects]] -from = "https://sh.vector.dev/*" -to = "http://sh.vector.dev.s3-website-us-east-1.amazonaws.com/:splat" -status = 200 -force = true - -[[redirects]] -from = "https://test-results.vector.dev/*" -to = "http://test-results.vector.dev.s3-website-us-east-1.amazonaws.com/:splat" -status = 200 -force = true - -[[redirects]] -from = "https://rustdoc.vector.dev/*" -to = "https://vector-rustdoc.netlify.app/vector/:splat" -status = 301 -force = true - -[[redirects]] -from = "/support/" -to = "https://www.datadoghq.com/product/observability-pipelines" -status = 301 -force = true - -[[redirects]] -from = "/support-services/" -to = "https://www.datadoghq.com/product/observability-pipelines" -status = 301 -force = true - -[[redirects]] -from = "https://setup.vector.dev/*" -to = "https://s3.amazonaws.com/dd-agent/scripts/install_script_vector0.sh" -status = 302 -force = true - -# Removed pages redirects -[[redirects]] -from = "/docs/reference/configuration/field-path-notation/" -to = "/docs/reference/vrl/expressions/#path" -force = true - -# CORS headers for /index.json -[[headers]] -for = "/index.json" - -[headers.values] -Access-Control-Allow-Origin = "*" - -# Netlify plugins -[[plugins]] -package = "@netlify/plugin-lighthouse" - -[plugins.inputs] -output_path = "reports/lighthouse/index.html" diff --git a/rust-doc/netlify.toml b/rust-doc/netlify.toml deleted file mode 100644 index 345a6e7adf850..0000000000000 --- a/rust-doc/netlify.toml +++ /dev/null @@ -1,9 +0,0 @@ -[build] -publish = "../target/doc/" -command = "make docs" - -[[redirects]] -from = "/" -to = "/vector" -status = 301 -force = false diff --git a/website/Brewfile.netlify b/website/Brewfile.netlify deleted file mode 100644 index 7bad8dd1207fb..0000000000000 --- a/website/Brewfile.netlify +++ /dev/null @@ -1,2 +0,0 @@ -brew "cue" -brew "htmltest" From 2a47dd96c30b8f5654a4207f553b86938ff9136c Mon Sep 17 00:00:00 2001 From: Devin Ford Date: Mon, 30 Oct 2023 18:50:48 -0400 Subject: [PATCH 16/16] fix: clean up workflows --- .github/workflows/create_preview_sites.yml | 44 ++++++++++++++-------- .github/workflows/preview_site_trigger.yml | 2 + 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/.github/workflows/create_preview_sites.yml b/.github/workflows/create_preview_sites.yml index f605d59e43cce..8c3b500fb5687 100644 --- a/.github/workflows/create_preview_sites.yml +++ b/.github/workflows/create_preview_sites.yml @@ -16,19 +16,6 @@ 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 }}\"}" \ - "$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 # Get the artifacts with the PR number and branch name - name: Download artifact @@ -50,7 +37,34 @@ jobs: }); fs.writeFileSync('${{ github.workspace }}/pr.zip', Buffer.from(download.data)); - - run: unzip pr.zip -d pr + # Extract the info from the artifact and set variables + - name: Extract PR info from artifact + run: | + unzip pr.zip -d pr + BRANCH_NAME=$(cat ./pr/PR_INFO | grep 'Branch Name' | cut -d ':' -f 2 | xargs) + SANITIZED_BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/[\/\.]/-/g') + echo "SANITIZED_BRANCH_NAME=$SANITIZED_BRANCH_NAME" >> $GITHUB_ENV + + # Kick off the job in amplify + - name: Deploy Site + 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\": \"$APP_ID\", \"branch_name\": \"$SANITIZED_BRANCH_NAME\"}" \ + "$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 @@ -63,8 +77,6 @@ jobs: const prInfo = fs.readFileSync('./pr/PR_INFO', 'utf8'); const prInfoLines = prInfo.split('\n'); const issueNumber = parseInt(prInfoLines[0].split(': ')[1]); - const branchName = prInfoLines[1].split(': ')[1]; - const SANITIZED_BRANCH_NAME = branchName.replace(/[\/\.]/g, '-') await github.issues.createComment({ owner: context.repo.owner, diff --git a/.github/workflows/preview_site_trigger.yml b/.github/workflows/preview_site_trigger.yml index 0e313805f108d..b89fe9273973a 100644 --- a/.github/workflows/preview_site_trigger.yml +++ b/.github/workflows/preview_site_trigger.yml @@ -12,12 +12,14 @@ jobs: run: | echo "Workflow has been allowed to run for PR ${{ github.event.number }}. Setting artifacts and then continuing workflow runs" + # Save the PR number and branch name to an artifact for use in subsequent jobs - name: Save PR number and Branch name run: | mkdir -p ./pr echo "PR Number: ${{ github.event.number }}" > ./pr/PR_INFO echo "Branch Name: ${{ github.head_ref }}" >> ./pr/PR_INFO + # Upload the artifact - name: Upload PR information artifact uses: actions/upload-artifact@v2 with: