From 502f5352fe300ca0b23226951fb49141afca4d9f Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Wed, 31 Jan 2024 09:32:46 -0500 Subject: [PATCH 01/69] fix: test file --- test.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test.txt diff --git a/test.txt b/test.txt new file mode 100644 index 0000000000..e69de29bb2 From 273953a2e386fab271bd1ad0d609fca225d8a0b5 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Wed, 31 Jan 2024 10:33:25 -0500 Subject: [PATCH 02/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 94069c1edb..c4aff0ca00 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -16,8 +16,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - ref: master - fetch-depth: 0 + ref: develop - name: Setup node uses: actions/setup-node@v4 From 983ad4cd1a99222e106a167d52842b002e3a30f9 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Wed, 31 Jan 2024 10:38:56 -0500 Subject: [PATCH 03/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index c4aff0ca00..c4118ae4db 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -17,6 +17,7 @@ jobs: uses: actions/checkout@v4 with: ref: develop + fetch-depth: 0 - name: Setup node uses: actions/setup-node@v4 From f15afe2c6f6c7a8745f77dcded8c0d4ebd713532 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Wed, 31 Jan 2024 14:54:39 -0500 Subject: [PATCH 04/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index c4118ae4db..2fd4ac5679 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -6,6 +6,7 @@ on: workflow_dispatch: env: YALESITES_BUILD_TOKEN: ${{ secrets.YALESITES_BUILD_TOKEN }} + GH_TOKEN: ${{ secrets.YALESITES_BUILD_TOKEN }} ACCESS_TOKEN: ${{ secrets.YALESITES_BUILD_TOKEN }} REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.number }} @@ -16,7 +17,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - ref: develop + ref: master fetch-depth: 0 - name: Setup node @@ -29,21 +30,17 @@ jobs: git config user.name github-actions git config user.email github-actions@github.com - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - - name: Get next release number run: | - git branch develop origin/develop - git merge develop --no-edit -X theirs - git status + git merge origin/develop --no-edit -X theirs npm install --force - npx --no-install semantic-release --no-ci --dry-run --branches master - next_version=$(npx --no-install semantic-release --no-ci --dry-run --branches master 2>/dev/null | sed -nE 's/.*the next release version is ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p') + npx --no-install semantic-release --no-ci --dry-run + next_version=$(npx --no-install semantic-release --no-ci --dry-run 2>/dev/null | sed -nE 's/.*The next release version is ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p') echo release_branch="rel-${next_version//.}" >> "$GITHUB_ENV" - name: Create release branch run: | + echo "$release_branch" git checkout -b "$release_branch" git push origin "$release_branch" From 30a6178d15ace2277d492263c01d79ecae2628e9 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Wed, 31 Jan 2024 14:55:20 -0500 Subject: [PATCH 05/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 2fd4ac5679..2524de9d99 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -35,7 +35,7 @@ jobs: git merge origin/develop --no-edit -X theirs npm install --force npx --no-install semantic-release --no-ci --dry-run - next_version=$(npx --no-install semantic-release --no-ci --dry-run 2>/dev/null | sed -nE 's/.*The next release version is ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p') + next_version=$(unset GITHUB_ACTIONS && npx --no-install semantic-release --no-ci --dry-run 2>/dev/null | sed -nE 's/.*The next release version is ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p') echo release_branch="rel-${next_version//.}" >> "$GITHUB_ENV" - name: Create release branch From bce7ae75a4d126cede6d1950164e7b983691c7f4 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Wed, 31 Jan 2024 14:59:00 -0500 Subject: [PATCH 06/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 2524de9d99..b902939361 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -30,12 +30,16 @@ jobs: git config user.name github-actions git config user.email github-actions@github.com + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + - name: Get next release number run: | git merge origin/develop --no-edit -X theirs npm install --force - npx --no-install semantic-release --no-ci --dry-run - next_version=$(unset GITHUB_ACTIONS && npx --no-install semantic-release --no-ci --dry-run 2>/dev/null | sed -nE 's/.*The next release version is ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p') + unset GITHUB_ACTIONS npx --no-install semantic-release --no-ci --dry-run + semantic_release=$(unset GITHUB_ACTIONS && npx --no-install semantic-release --no-ci --dry-run 2>/dev/null) + next_version=$(echo "$semantic_release" | sed -nE 's/.*The next release version is ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p') echo release_branch="rel-${next_version//.}" >> "$GITHUB_ENV" - name: Create release branch From 627e14a9f55aaa314298d472055b0d75dbcc8101 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Wed, 31 Jan 2024 15:12:46 -0500 Subject: [PATCH 07/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index b902939361..047f005a63 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -30,21 +30,16 @@ jobs: git config user.name github-actions git config user.email github-actions@github.com - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - - name: Get next release number run: | git merge origin/develop --no-edit -X theirs npm install --force - unset GITHUB_ACTIONS npx --no-install semantic-release --no-ci --dry-run semantic_release=$(unset GITHUB_ACTIONS && npx --no-install semantic-release --no-ci --dry-run 2>/dev/null) next_version=$(echo "$semantic_release" | sed -nE 's/.*The next release version is ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p') echo release_branch="rel-${next_version//.}" >> "$GITHUB_ENV" - name: Create release branch run: | - echo "$release_branch" git checkout -b "$release_branch" git push origin "$release_branch" From 2f19646a708bba8bf88c812bedd053caf3e40ca0 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Thu, 1 Feb 2024 10:40:50 -0500 Subject: [PATCH 08/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 047f005a63..d61b26d1df 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -34,9 +34,18 @@ jobs: run: | git merge origin/develop --no-edit -X theirs npm install --force - semantic_release=$(unset GITHUB_ACTIONS && npx --no-install semantic-release --no-ci --dry-run 2>/dev/null) - next_version=$(echo "$semantic_release" | sed -nE 's/.*The next release version is ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p') - echo release_branch="rel-${next_version//.}" >> "$GITHUB_ENV" + unset GITHUB_ACTIONS + unset GITHUB_EVENT_NAME + semantic_release=$(npx --no-install semantic-release --no-ci --dry-run 2>/dev/null) + next_version=$(echo "$semantic_release" | sed -nE 's/.*The next release version is ([0-9]+)\.([0-9]+)\.([0-9]+).*/\1\2\3/p') + + if [ -z "$next_version" ]; then + release_branch="release" + else + release_branch="v${next_version//.}" + fi + + echo release_branch="$release_branch" >> "$GITHUB_ENV" - name: Create release branch run: | From 480a027346d8da75b0ecc24ebc21f957ed58e7d8 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Thu, 1 Feb 2024 11:22:54 -0500 Subject: [PATCH 09/69] Update create_release_pull_request --- .ci/github/create_release_pull_request | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/github/create_release_pull_request b/.ci/github/create_release_pull_request index 69242acaeb..84bee86781 100755 --- a/.ci/github/create_release_pull_request +++ b/.ci/github/create_release_pull_request @@ -2,11 +2,11 @@ set -eo pipefail -# If we aren't updating an existing pull request, create one to merge develop into master. +# If we aren't updating an existing pull request, create one to merge the release branch into master. if [[ -z "$PR_NUMBER" ]]; then pull_request_response=$(curl -s -H "Accept: application/vnd.github+json" \ -H "Authorization: token $ACCESS_TOKEN" \ - -X POST -d '{"title": "Release", "head": "develop", "base": "master"}' \ + -X POST -d "{'title': 'Release', 'head': $RELEASE_BRANCH, 'base': 'master'}" \ "https://api.github.com/repos/$REPO/pulls") message=$(echo "$pull_request_response" | jq -r 'if has("errors") then .errors[].message else null end') From d54ffa19b43290bb65e55d470366271da837773c Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Thu, 1 Feb 2024 11:23:09 -0500 Subject: [PATCH 10/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index d61b26d1df..7dade83165 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -13,6 +13,7 @@ env: jobs: get_next_release_version: runs-on: ubuntu-latest + if: ${{ env.PR_NUMBER == '' }} steps: - name: Checkout uses: actions/checkout@v4 @@ -40,19 +41,32 @@ jobs: next_version=$(echo "$semantic_release" | sed -nE 's/.*The next release version is ([0-9]+)\.([0-9]+)\.([0-9]+).*/\1\2\3/p') if [ -z "$next_version" ]; then - release_branch="release" + exit 1 else release_branch="v${next_version//.}" fi echo release_branch="$release_branch" >> "$GITHUB_ENV" - - name: Create release branch + - name: Create release branch (${{ env.release_branch }}) run: | git checkout -b "$release_branch" git push origin "$release_branch" - # create_pull_request: + create_pull_request: + if: github.head_ref == 'develop' || + github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Create pull request + env: + RELEASE_BRANCH: ${{ env.release_branch }} + run: ./.ci/github/create_release_pull_request + + # create_multidevs: # if: github.head_ref == 'develop' || # github.event_name == 'workflow_dispatch' # runs-on: ubuntu-latest @@ -60,5 +74,7 @@ jobs: # - name: Checkout # uses: actions/checkout@v4 - # - name: Create pull request - # run: ./.ci/github/create_release_pull_request + # - name: Create multidev environments + # env: + # RELEASE_BRANCH: ${{ env.release_branch }} + # run: ./.ci/github/create_multidevs From 36ec49e132b7b0051aee692a876635541a58caa8 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Thu, 1 Feb 2024 11:29:48 -0500 Subject: [PATCH 11/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 7dade83165..ecaaf3a560 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -13,7 +13,7 @@ env: jobs: get_next_release_version: runs-on: ubuntu-latest - if: ${{ env.PR_NUMBER == '' }} + if: ${{ github.event.number == '' }} steps: - name: Checkout uses: actions/checkout@v4 From 058b20ef4ef984de8c802cf20295a3afb13db215 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Thu, 1 Feb 2024 15:54:23 -0500 Subject: [PATCH 12/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index ecaaf3a560..08bd604b73 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -56,6 +56,7 @@ jobs: create_pull_request: if: github.head_ref == 'develop' || github.event_name == 'workflow_dispatch' + needs: [get_next_release_version] runs-on: ubuntu-latest steps: - name: Checkout From 8666c33878593ad0f984bb78f7c8027d59b44e51 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Thu, 1 Feb 2024 16:05:27 -0500 Subject: [PATCH 13/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 08bd604b73..300f6cb5af 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -14,6 +14,8 @@ jobs: get_next_release_version: runs-on: ubuntu-latest if: ${{ github.event.number == '' }} + outputs: + release_branch: ${{ steps.get_release_number.outputs.release_branch }} steps: - name: Checkout uses: actions/checkout@v4 @@ -32,6 +34,7 @@ jobs: git config user.email github-actions@github.com - name: Get next release number + id: get_release_number run: | git merge origin/develop --no-edit -X theirs npm install --force @@ -46,7 +49,7 @@ jobs: release_branch="v${next_version//.}" fi - echo release_branch="$release_branch" >> "$GITHUB_ENV" + echo release_branch="$release_branch" >> "$GITHUB_OUTPUT" - name: Create release branch (${{ env.release_branch }}) run: | @@ -64,7 +67,7 @@ jobs: - name: Create pull request env: - RELEASE_BRANCH: ${{ env.release_branch }} + RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }}" run: ./.ci/github/create_release_pull_request # create_multidevs: From 23695ecbe692485a9b7563746f56a418339fa431 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Thu, 1 Feb 2024 16:15:56 -0500 Subject: [PATCH 14/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 300f6cb5af..7ee64dd968 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -51,10 +51,13 @@ jobs: echo release_branch="$release_branch" >> "$GITHUB_OUTPUT" - - name: Create release branch (${{ env.release_branch }}) + - name: Create release branch + env: + RELEASE_BRANCH: ${{ steps.get_release_number.outputs.release_branch }} run: | - git checkout -b "$release_branch" - git push origin "$release_branch" + echo "The release branch is: $RELEASE_BRANCH" + git checkout -b "$RELEASE_BRANCH" + git push origin "$RELEASE_BRANCH" create_pull_request: if: github.head_ref == 'develop' || @@ -67,7 +70,7 @@ jobs: - name: Create pull request env: - RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }}" + RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }} run: ./.ci/github/create_release_pull_request # create_multidevs: From 553bb096e4b45c66d69801897df68b3a403f1234 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Thu, 1 Feb 2024 16:23:37 -0500 Subject: [PATCH 15/69] Update create_release_pull_request --- .ci/github/create_release_pull_request | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/github/create_release_pull_request b/.ci/github/create_release_pull_request index 84bee86781..d5bdebab15 100755 --- a/.ci/github/create_release_pull_request +++ b/.ci/github/create_release_pull_request @@ -6,7 +6,7 @@ set -eo pipefail if [[ -z "$PR_NUMBER" ]]; then pull_request_response=$(curl -s -H "Accept: application/vnd.github+json" \ -H "Authorization: token $ACCESS_TOKEN" \ - -X POST -d "{'title': 'Release', 'head': $RELEASE_BRANCH, 'base': 'master'}" \ + -X POST -d '{"title": "Release", "head": "'"$RELEASE_BRANCH"'", "base": "master"}' \ "https://api.github.com/repos/$REPO/pulls") message=$(echo "$pull_request_response" | jq -r 'if has("errors") then .errors[].message else null end') From c3f7a4ddbc291d1abe7f1df659d7a645f5903541 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Thu, 1 Feb 2024 19:39:14 -0500 Subject: [PATCH 16/69] Update create_release_pull_request --- .ci/github/create_release_pull_request | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/github/create_release_pull_request b/.ci/github/create_release_pull_request index d5bdebab15..c477d24f5f 100755 --- a/.ci/github/create_release_pull_request +++ b/.ci/github/create_release_pull_request @@ -9,7 +9,7 @@ if [[ -z "$PR_NUMBER" ]]; then -X POST -d '{"title": "Release", "head": "'"$RELEASE_BRANCH"'", "base": "master"}' \ "https://api.github.com/repos/$REPO/pulls") - message=$(echo "$pull_request_response" | jq -r 'if has("errors") then .errors[].message else null end') + message=$(echo "$pull_request_response" | jq -r 'if has("errors") then .errors[].message else empty end') # Check if the pull request creation was successful. if [[ -n "$message" ]]; then From 7ab1098d8b8f0f10a8a9c766bf6edab4169d3fcc Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Fri, 2 Feb 2024 15:14:09 -0500 Subject: [PATCH 17/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 7ee64dd968..87dfc38327 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -13,7 +13,6 @@ env: jobs: get_next_release_version: runs-on: ubuntu-latest - if: ${{ github.event.number == '' }} outputs: release_branch: ${{ steps.get_release_number.outputs.release_branch }} steps: @@ -36,22 +35,26 @@ jobs: - name: Get next release number id: get_release_number run: | - git merge origin/develop --no-edit -X theirs - npm install --force - unset GITHUB_ACTIONS - unset GITHUB_EVENT_NAME - semantic_release=$(npx --no-install semantic-release --no-ci --dry-run 2>/dev/null) - next_version=$(echo "$semantic_release" | sed -nE 's/.*The next release version is ([0-9]+)\.([0-9]+)\.([0-9]+).*/\1\2\3/p') - - if [ -z "$next_version" ]; then - exit 1 + if [[ "$PR_NUMBER" ]]; then + release_branch=$(gh pr view "$PR_NUMBER" --json headRefName --jq '.[]') else - release_branch="v${next_version//.}" + git merge origin/develop --no-edit -X theirs + npm install --force + unset GITHUB_ACTIONS + unset GITHUB_EVENT_NAME + semantic_release=$(npx --no-install semantic-release --no-ci --dry-run 2>/dev/null) + next_version=$(echo "$semantic_release" | sed -nE 's/.*The next release version is ([0-9]+)\.([0-9]+)\.([0-9]+).*/\1\2\3/p') + + if [ -z "$next_version" ]; then + exit 1 + else + release_branch="v${next_version//.}" + fi fi - echo release_branch="$release_branch" >> "$GITHUB_OUTPUT" - name: Create release branch + if: ${{ github.event.number == '' }} env: RELEASE_BRANCH: ${{ steps.get_release_number.outputs.release_branch }} run: | From 25153ed6faf2740e00dd3fdc8575bacb6ce7eec1 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Fri, 2 Feb 2024 15:28:58 -0500 Subject: [PATCH 18/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 87dfc38327..fe7cf7c712 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -63,7 +63,9 @@ jobs: git push origin "$RELEASE_BRANCH" create_pull_request: - if: github.head_ref == 'develop' || + env: + RELEASE_BRdANCH: ${{ needs.get_next_release_version.outputs.release_branch }} + if: github.head_ref == ${{ env.RELEASE_BRANCH }} || github.event_name == 'workflow_dispatch' needs: [get_next_release_version] runs-on: ubuntu-latest @@ -72,8 +74,6 @@ jobs: uses: actions/checkout@v4 - name: Create pull request - env: - RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }} run: ./.ci/github/create_release_pull_request # create_multidevs: From 62ba685129b713711156dfabf5bf8008ab6b60ea Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Fri, 2 Feb 2024 15:30:53 -0500 Subject: [PATCH 19/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index fe7cf7c712..d6cdf39d3e 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -64,7 +64,7 @@ jobs: create_pull_request: env: - RELEASE_BRdANCH: ${{ needs.get_next_release_version.outputs.release_branch }} + RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }} if: github.head_ref == ${{ env.RELEASE_BRANCH }} || github.event_name == 'workflow_dispatch' needs: [get_next_release_version] From c2f74c7c26aac0378eb5caf807036171045226f4 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Fri, 2 Feb 2024 15:48:25 -0500 Subject: [PATCH 20/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index d6cdf39d3e..c52b937429 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -63,17 +63,16 @@ jobs: git push origin "$RELEASE_BRANCH" create_pull_request: + needs: [get_next_release_version] env: RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }} - if: github.head_ref == ${{ env.RELEASE_BRANCH }} || - github.event_name == 'workflow_dispatch' - needs: [get_next_release_version] runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Create pull request + if: github.head_ref == env.RELEASE_BRANCH || github.event_name == 'workflow_dispatch' run: ./.ci/github/create_release_pull_request # create_multidevs: From ab1fd1f9557037ffc3081860f20d6b08bc138a25 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Sun, 4 Feb 2024 23:04:53 -0500 Subject: [PATCH 21/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index c52b937429..cea7bf5bcf 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -1,6 +1,8 @@ name: Create/update release pull request on: pull_request: + types: + - synchronize branches: - master workflow_dispatch: From f7dd4eaac7b892c87d2c0badab4475ebff7c6e40 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Sun, 4 Feb 2024 23:08:31 -0500 Subject: [PATCH 22/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index cea7bf5bcf..624d92cbc2 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -1,10 +1,10 @@ name: Create/update release pull request on: - pull_request: - types: - - synchronize - branches: - - master + # pull_request: + # types: + # - synchronize + # branches: + # - master workflow_dispatch: env: YALESITES_BUILD_TOKEN: ${{ secrets.YALESITES_BUILD_TOKEN }} From ceae86abd557371647e459a6c0fd383b3dd19645 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Sun, 4 Feb 2024 23:22:30 -0500 Subject: [PATCH 23/69] test --- test.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test.txt b/test.txt index e69de29bb2..77356c3140 100644 --- a/test.txt +++ b/test.txt @@ -0,0 +1 @@ +test From fcb4cec687eee132691fc8e80c3194cc1e5485f6 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Sun, 4 Feb 2024 23:25:14 -0500 Subject: [PATCH 24/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 624d92cbc2..05c8812384 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -1,10 +1,10 @@ name: Create/update release pull request on: - # pull_request: - # types: - # - synchronize - # branches: - # - master + pull_request: + # types: + # - synchronize + branches: + - master workflow_dispatch: env: YALESITES_BUILD_TOKEN: ${{ secrets.YALESITES_BUILD_TOKEN }} From 0f9ed96c0d41371095f4beb8f838cd2baa134e75 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Mon, 5 Feb 2024 11:06:27 -0500 Subject: [PATCH 25/69] debug contexts --- .github/workflows/release_pr.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 05c8812384..cc510d55e2 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -73,6 +73,31 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - name: Dump job context + env: + JOB_CONTEXT: ${{ toJson(job) }} + run: echo "$JOB_CONTEXT" + - name: Dump steps context + env: + STEPS_CONTEXT: ${{ toJson(steps) }} + run: echo "$STEPS_CONTEXT" + - name: Dump runner context + env: + RUNNER_CONTEXT: ${{ toJson(runner) }} + run: echo "$RUNNER_CONTEXT" + - name: Dump strategy context + env: + STRATEGY_CONTEXT: ${{ toJson(strategy) }} + run: echo "$STRATEGY_CONTEXT" + - name: Dump matrix context + env: + MATRIX_CONTEXT: ${{ toJson(matrix) }} + run: echo "$MATRIX_CONTEXT" + - name: Create pull request if: github.head_ref == env.RELEASE_BRANCH || github.event_name == 'workflow_dispatch' run: ./.ci/github/create_release_pull_request From ea48671336e009b73c13c7c2c5a75317f982b26f Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Mon, 5 Feb 2024 11:47:01 -0500 Subject: [PATCH 26/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index cc510d55e2..a885be3646 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -12,6 +12,7 @@ env: ACCESS_TOKEN: ${{ secrets.YALESITES_BUILD_TOKEN }} REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.number }} + RELEASE_PR_URL: ${{ github.event.pull_request.html.href }} jobs: get_next_release_version: runs-on: ubuntu-latest @@ -73,31 +74,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - name: Dump job context - env: - JOB_CONTEXT: ${{ toJson(job) }} - run: echo "$JOB_CONTEXT" - - name: Dump steps context - env: - STEPS_CONTEXT: ${{ toJson(steps) }} - run: echo "$STEPS_CONTEXT" - - name: Dump runner context - env: - RUNNER_CONTEXT: ${{ toJson(runner) }} - run: echo "$RUNNER_CONTEXT" - - name: Dump strategy context - env: - STRATEGY_CONTEXT: ${{ toJson(strategy) }} - run: echo "$STRATEGY_CONTEXT" - - name: Dump matrix context - env: - MATRIX_CONTEXT: ${{ toJson(matrix) }} - run: echo "$MATRIX_CONTEXT" - - name: Create pull request if: github.head_ref == env.RELEASE_BRANCH || github.event_name == 'workflow_dispatch' run: ./.ci/github/create_release_pull_request From 2c0de422d9c51d6a308462656a3fe03e1447e49a Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Mon, 5 Feb 2024 11:47:56 -0500 Subject: [PATCH 27/69] Update create_release_pull_request --- .ci/github/create_release_pull_request | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/github/create_release_pull_request b/.ci/github/create_release_pull_request index c477d24f5f..297d39abc6 100755 --- a/.ci/github/create_release_pull_request +++ b/.ci/github/create_release_pull_request @@ -63,7 +63,7 @@ for sha in $commit_shas; do "https://api.github.com/repos/$REPO/commits/$sha/pulls" \ | jq -r 'if type == "object" and has("message") and length > 0 then null else .[].html_url // empty end') - if [[ -n "$single_pr_url" && "$single_pr_url" != "null" ]]; then + if [[ -n "$single_pr_url" && "$single_pr_url" != "null" && "$single_pr_url" != "$RELEASE_PR_URL" ]]; then pull_requests+=("$single_pr_url") elif [[ "$single_pr_url" == "null" ]]; then : From 38cd0a37a41c8b1270ba0289e3fc1894215b23fe Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Mon, 5 Feb 2024 11:52:29 -0500 Subject: [PATCH 28/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index a885be3646..c8a8497d87 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -12,7 +12,7 @@ env: ACCESS_TOKEN: ${{ secrets.YALESITES_BUILD_TOKEN }} REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.number }} - RELEASE_PR_URL: ${{ github.event.pull_request.html.href }} + RELEASE_PR_URL: ${{ github.event.pull_request._links.html.href }} jobs: get_next_release_version: runs-on: ubuntu-latest From b6fa57b1168932e07e8e97b27b64c87c97dba274 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Mon, 5 Feb 2024 16:02:15 -0500 Subject: [PATCH 29/69] Create deploy_release_sites --- .ci/github/deploy_release_sites | 76 +++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .ci/github/deploy_release_sites diff --git a/.ci/github/deploy_release_sites b/.ci/github/deploy_release_sites new file mode 100644 index 0000000000..383e20c87c --- /dev/null +++ b/.ci/github/deploy_release_sites @@ -0,0 +1,76 @@ +#!/bin/bash + +set -eo pipefail + +# Authenticate with Terminus and install Terminus Build Bools. +terminus -n auth:login --machine-token="$TERMINUS_TOKEN" +terminus self:plugin:install terminus-build-tools-plugin + +# Get release sites and convert to an array. +release_sites=$(gh api /repos/"$REPO"/actions/variables --jq '.variables.[] | select(.name=="RELEASE_SITES") | .value') +readarray -t sites <<< "$release_sites" + +# Release branch variable does not exist, so create multidevs for the first time. +if [ "$RELEASE_BRANCH" ]; then + # Set release branch. + #gh variable set RELEASE_BRANCH --body "$RELEASE_BRANCH" + + # Prepare output file for comment. + echo "Environments for review:" >> /tmp/multidev_output.txt +else + echo "test" + # Get release branch if already set. + #release_branch=$(gh api /repos/"$REPO"/actions/variables --jq '.variables.[] | select(.name=="RELEASE_BRANCH") | .value') +fi + +push_code() { + git_path=$(terminus connection:info "$site_with_env" --field=git_url) + git remote add "$site_machine_name" "$git_path" + git fetch "$site_machine_name" + git push "$site_machine_name" "$RELEASE_BRANCH:$RELEASE_BRANCH" --force + terminus workflow:wait "$site_machine_name"."$RELEASE_BRANCH" --max=300 +} + +process_site() { + site_with_env="$1" + site_machine_name="${site_with_env%.*}" + + echo -e "\nCreating multidev $site_machine_name.$RELEASE_BRANCH from $site_with_env...\n" + + if [ "$site_machine_name" = "yalesites-platform" ]; then + terminus multidev:create "$site_with_env" "$RELEASE_BRANCH" --no-db --no-files + else + terminus multidev:create "$site_with_env" "$RELEASE_BRANCH" + fi + + push_code + + # Do a fresh install on yalesites-platform site. + if [ "$site_machine_name" = "yalesites-platform" ]; then + echo -e "\nInstalling clean site for $site_machine_name.$RELEASE_BRANCH...\n" + terminus -n env:wake "$site_machine_name"."$RELEASE_BRANCH" + terminus -n drush "$site_machine_name"."$RELEASE_BRANCH" -- si yalesites_profile -y + terminus -n drush "$site_machine_name"."$RELEASE_BRANCH" -- cr + SITE_MACHINE_NAME="$site_machine_name" env="$RELEASE_BRANCH" ./scripts/shared/content-import.sh + fi + + terminus -n env:wake "$site_machine_name"."$RELEASE_BRANCH" + echo -e "\nRunning drush deploy...\n" + terminus -n drush "$site_machine_name"."$RELEASE_BRANCH" -- deploy -v -y + + # Get site URL and output to file + site_url=$(terminus -n domain:list "$site_machine_name"."$RELEASE_BRANCH" --filter='type=platform' --field=id) + echo "- https://$site_url" >> /tmp/multidev_output.txt +} + +# Export functions so that GNU Parallel can access them +export -f push_code +export -f process_site + +parallel --keep-order --line-buffer process_site {} ::: "${sites[@]}" + +# If we are creating the PR for the first time, post a comment with the created site URLs. +gh issue comment "$PR_NUMBER" --body-file /tmp/multidev_output.txt + +# TODO: after PR closed, delete multidevs +# TODO: support new commits, push new code to multidevs From 4619c2fc1a2258f1dde645298c4d632b73f8561d Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Mon, 5 Feb 2024 16:05:01 -0500 Subject: [PATCH 30/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index c8a8497d87..5d623dac35 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -78,15 +78,16 @@ jobs: if: github.head_ref == env.RELEASE_BRANCH || github.event_name == 'workflow_dispatch' run: ./.ci/github/create_release_pull_request - # create_multidevs: - # if: github.head_ref == 'develop' || - # github.event_name == 'workflow_dispatch' - # runs-on: ubuntu-latest - # steps: - # - name: Checkout - # uses: actions/checkout@v4 + release_sites: + needs: [create_pull_request] + runs-on: ubuntu-latest + env: + RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ env.RELEASE_BRANCH }} - # - name: Create multidev environments - # env: - # RELEASE_BRANCH: ${{ env.release_branch }} - # run: ./.ci/github/create_multidevs + - name: Deploy to environments + run: ./.ci/github/deploy_release_sites From 38bfc7a6fd1a25a5ae10acaa28925d4d481a920c Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Mon, 5 Feb 2024 19:58:29 -0500 Subject: [PATCH 31/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 5d623dac35..24dba63637 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -1,8 +1,8 @@ name: Create/update release pull request on: pull_request: - # types: - # - synchronize + types: + - synchronize branches: - master workflow_dispatch: From 2ca5ea61d581a30c26954326a76429c06565907e Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Mon, 5 Feb 2024 20:00:40 -0500 Subject: [PATCH 32/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 24dba63637..c017f98234 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -1,4 +1,4 @@ -name: Create/update release pull request +name: Release pull request on: pull_request: types: From 7c47da7def42043c92f41ba7c69bd29ecfd926fc Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Mon, 5 Feb 2024 22:20:42 -0500 Subject: [PATCH 33/69] Update create_release_pull_request --- .ci/github/create_release_pull_request | 46 +++++++++++++------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/.ci/github/create_release_pull_request b/.ci/github/create_release_pull_request index 297d39abc6..a51f225c18 100755 --- a/.ci/github/create_release_pull_request +++ b/.ci/github/create_release_pull_request @@ -3,33 +3,33 @@ set -eo pipefail # If we aren't updating an existing pull request, create one to merge the release branch into master. -if [[ -z "$PR_NUMBER" ]]; then - pull_request_response=$(curl -s -H "Accept: application/vnd.github+json" \ - -H "Authorization: token $ACCESS_TOKEN" \ - -X POST -d '{"title": "Release", "head": "'"$RELEASE_BRANCH"'", "base": "master"}' \ - "https://api.github.com/repos/$REPO/pulls") - - message=$(echo "$pull_request_response" | jq -r 'if has("errors") then .errors[].message else empty end') - - # Check if the pull request creation was successful. - if [[ -n "$message" ]]; then - echo "Failed to create pull request." - echo "Error: $message" - exit 1 - else - pr_url=$(echo "$pull_request_response" | jq -r '.html_url') - fi - - # Extract the pull request number from the response. - PR_NUMBER=$(echo "$pull_request_response" | jq -r '.number') - -# If there is an existing PR number, get the PR. -else +# if [[ -z "$PR_NUMBER" ]]; then +# pull_request_response=$(curl -s -H "Accept: application/vnd.github+json" \ +# -H "Authorization: token $ACCESS_TOKEN" \ +# -X POST -d '{"title": "Release", "head": "'"$RELEASE_BRANCH"'", "base": "master"}' \ +# "https://api.github.com/repos/$REPO/pulls") + +# message=$(echo "$pull_request_response" | jq -r 'if has("errors") then .errors[].message else empty end') + +# # Check if the pull request creation was successful. +# if [[ -n "$message" ]]; then +# echo "Failed to create pull request." +# echo "Error: $message" +# exit 1 +# else +# pr_url=$(echo "$pull_request_response" | jq -r '.html_url') +# fi + +# # Extract the pull request number from the response. +# PR_NUMBER=$(echo "$pull_request_response" | jq -r '.number') + +# # If there is an existing PR number, get the PR. +# else pull_request_response=$(curl --silent -H "Authorization: token $ACCESS_TOKEN" \ "https://api.github.com/repos/$REPO/pulls/$PR_NUMBER") pr_url=$(echo "$pull_request_response" | jq -r '.html_url') -fi +# fi # Page through the /pulls/#/commits endpoint. page=1 From 986db178162cd6c7093893fef9aacbdd9093dc59 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Mon, 5 Feb 2024 22:20:55 -0500 Subject: [PATCH 34/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index c017f98234..2a09e5d1a6 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -74,8 +74,14 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Create Pull Request + id: create_pr + uses: peter-evans/create-pull-request@v6 + - name: Create pull request if: github.head_ref == env.RELEASE_BRANCH || github.event_name == 'workflow_dispatch' + env: + PR_NUMBER: ${{ steps.create_pr.outputs.pull-request-number }} run: ./.ci/github/create_release_pull_request release_sites: From 5cc3301a4a1fef318ac6fb73cdd0c72198f21ada Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Mon, 5 Feb 2024 22:27:04 -0500 Subject: [PATCH 35/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 2a09e5d1a6..a1c37deba7 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -77,6 +77,8 @@ jobs: - name: Create Pull Request id: create_pr uses: peter-evans/create-pull-request@v6 + with: + branch: ${{ env.RELEASE_BRANCH }} - name: Create pull request if: github.head_ref == env.RELEASE_BRANCH || github.event_name == 'workflow_dispatch' From 96458a00755cd3531cf23c2eddbc7676d14e767a Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Mon, 5 Feb 2024 22:41:51 -0500 Subject: [PATCH 36/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index a1c37deba7..4e7fc51da0 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -56,14 +56,14 @@ jobs: fi echo release_branch="$release_branch" >> "$GITHUB_OUTPUT" - - name: Create release branch - if: ${{ github.event.number == '' }} - env: - RELEASE_BRANCH: ${{ steps.get_release_number.outputs.release_branch }} - run: | - echo "The release branch is: $RELEASE_BRANCH" - git checkout -b "$RELEASE_BRANCH" - git push origin "$RELEASE_BRANCH" + # - name: Create release branch + # if: ${{ github.event.number == '' }} + # env: + # RELEASE_BRANCH: ${{ steps.get_release_number.outputs.release_branch }} + # run: | + # echo "The release branch is: $RELEASE_BRANCH" + # git checkout -b "$RELEASE_BRANCH" + # git push origin "$RELEASE_BRANCH" create_pull_request: needs: [get_next_release_version] @@ -79,6 +79,7 @@ jobs: uses: peter-evans/create-pull-request@v6 with: branch: ${{ env.RELEASE_BRANCH }} + token: ${{ secrets.YALESITES_BUILD_TOKEN }} - name: Create pull request if: github.head_ref == env.RELEASE_BRANCH || github.event_name == 'workflow_dispatch' From f7a501b58ea03eb9aa2be41fe26ca05b1aec4f24 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Mon, 5 Feb 2024 22:42:12 -0500 Subject: [PATCH 37/69] Delete test.txt --- test.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 test.txt diff --git a/test.txt b/test.txt deleted file mode 100644 index 77356c3140..0000000000 --- a/test.txt +++ /dev/null @@ -1 +0,0 @@ -test From 0f95899e16107fc951e13395c16d6c8f1581640a Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Mon, 5 Feb 2024 22:46:33 -0500 Subject: [PATCH 38/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 4e7fc51da0..16755c282b 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -79,7 +79,8 @@ jobs: uses: peter-evans/create-pull-request@v6 with: branch: ${{ env.RELEASE_BRANCH }} - token: ${{ secrets.YALESITES_BUILD_TOKEN }} + token: ${{ secrets.YALESITES_BUILD_TOKEN + base: master - name: Create pull request if: github.head_ref == env.RELEASE_BRANCH || github.event_name == 'workflow_dispatch' From 765c6e4793f3bcd6bf3a9c9bb7a1fb39ab104f49 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Mon, 5 Feb 2024 22:47:41 -0500 Subject: [PATCH 39/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 16755c282b..1783ae2f94 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -79,7 +79,7 @@ jobs: uses: peter-evans/create-pull-request@v6 with: branch: ${{ env.RELEASE_BRANCH }} - token: ${{ secrets.YALESITES_BUILD_TOKEN + token: ${{ secrets.YALESITES_BUILD_TOKEN }} base: master - name: Create pull request From 5732fe629bd17f575a40f98ecfeeb0f5d5637389 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 10:35:56 -0500 Subject: [PATCH 40/69] Update create_release_pull_request --- .ci/github/create_release_pull_request | 46 +++++++++++++------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/.ci/github/create_release_pull_request b/.ci/github/create_release_pull_request index a51f225c18..297d39abc6 100755 --- a/.ci/github/create_release_pull_request +++ b/.ci/github/create_release_pull_request @@ -3,33 +3,33 @@ set -eo pipefail # If we aren't updating an existing pull request, create one to merge the release branch into master. -# if [[ -z "$PR_NUMBER" ]]; then -# pull_request_response=$(curl -s -H "Accept: application/vnd.github+json" \ -# -H "Authorization: token $ACCESS_TOKEN" \ -# -X POST -d '{"title": "Release", "head": "'"$RELEASE_BRANCH"'", "base": "master"}' \ -# "https://api.github.com/repos/$REPO/pulls") - -# message=$(echo "$pull_request_response" | jq -r 'if has("errors") then .errors[].message else empty end') - -# # Check if the pull request creation was successful. -# if [[ -n "$message" ]]; then -# echo "Failed to create pull request." -# echo "Error: $message" -# exit 1 -# else -# pr_url=$(echo "$pull_request_response" | jq -r '.html_url') -# fi - -# # Extract the pull request number from the response. -# PR_NUMBER=$(echo "$pull_request_response" | jq -r '.number') - -# # If there is an existing PR number, get the PR. -# else +if [[ -z "$PR_NUMBER" ]]; then + pull_request_response=$(curl -s -H "Accept: application/vnd.github+json" \ + -H "Authorization: token $ACCESS_TOKEN" \ + -X POST -d '{"title": "Release", "head": "'"$RELEASE_BRANCH"'", "base": "master"}' \ + "https://api.github.com/repos/$REPO/pulls") + + message=$(echo "$pull_request_response" | jq -r 'if has("errors") then .errors[].message else empty end') + + # Check if the pull request creation was successful. + if [[ -n "$message" ]]; then + echo "Failed to create pull request." + echo "Error: $message" + exit 1 + else + pr_url=$(echo "$pull_request_response" | jq -r '.html_url') + fi + + # Extract the pull request number from the response. + PR_NUMBER=$(echo "$pull_request_response" | jq -r '.number') + +# If there is an existing PR number, get the PR. +else pull_request_response=$(curl --silent -H "Authorization: token $ACCESS_TOKEN" \ "https://api.github.com/repos/$REPO/pulls/$PR_NUMBER") pr_url=$(echo "$pull_request_response" | jq -r '.html_url') -# fi +fi # Page through the /pulls/#/commits endpoint. page=1 From f8ecdb168f7b472a083b932d21fec671720d1520 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 10:36:24 -0500 Subject: [PATCH 41/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 48 +++++++++++++------------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 1783ae2f94..50d5498a8c 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -56,14 +56,14 @@ jobs: fi echo release_branch="$release_branch" >> "$GITHUB_OUTPUT" - # - name: Create release branch - # if: ${{ github.event.number == '' }} - # env: - # RELEASE_BRANCH: ${{ steps.get_release_number.outputs.release_branch }} - # run: | - # echo "The release branch is: $RELEASE_BRANCH" - # git checkout -b "$RELEASE_BRANCH" - # git push origin "$RELEASE_BRANCH" + - name: Create release branch + if: ${{ github.event.number == '' }} + env: + RELEASE_BRANCH: ${{ steps.get_release_number.outputs.release_branch }} + run: | + echo "The release branch is: $RELEASE_BRANCH" + git checkout -b "$RELEASE_BRANCH" + git push origin "$RELEASE_BRANCH" create_pull_request: needs: [get_next_release_version] @@ -74,30 +74,22 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Create Pull Request - id: create_pr - uses: peter-evans/create-pull-request@v6 - with: - branch: ${{ env.RELEASE_BRANCH }} - token: ${{ secrets.YALESITES_BUILD_TOKEN }} - base: master - - name: Create pull request if: github.head_ref == env.RELEASE_BRANCH || github.event_name == 'workflow_dispatch' env: PR_NUMBER: ${{ steps.create_pr.outputs.pull-request-number }} run: ./.ci/github/create_release_pull_request - release_sites: - needs: [create_pull_request] - runs-on: ubuntu-latest - env: - RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }} - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ env.RELEASE_BRANCH }} + # release_sites: + # needs: [create_pull_request] + # runs-on: ubuntu-latest + # env: + # RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }} + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # ref: ${{ env.RELEASE_BRANCH }} - - name: Deploy to environments - run: ./.ci/github/deploy_release_sites + # - name: Deploy to environments + # run: ./.ci/github/deploy_release_sites From 7b2fd7081e7085f161da08ce2f7557f81499c230 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 11:19:10 -0500 Subject: [PATCH 42/69] Update create_release_pull_request --- .ci/github/create_release_pull_request | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.ci/github/create_release_pull_request b/.ci/github/create_release_pull_request index 297d39abc6..51539c29d5 100755 --- a/.ci/github/create_release_pull_request +++ b/.ci/github/create_release_pull_request @@ -31,6 +31,10 @@ else pr_url=$(echo "$pull_request_response" | jq -r '.html_url') fi +if [[ -z "$RELEASE_PR_URL" ]]; then + RELEASE_PR_URL="$pr_url" +fi + # Page through the /pulls/#/commits endpoint. page=1 per_page=100 From 30121a1c4fba5738237f3f0e44458f4f8884213e Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 11:30:23 -0500 Subject: [PATCH 43/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 50d5498a8c..9252a9f743 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -16,6 +16,7 @@ env: jobs: get_next_release_version: runs-on: ubuntu-latest + if: ${{ github.event.action != 'synchronize' }} outputs: release_branch: ${{ steps.get_release_number.outputs.release_branch }} steps: @@ -76,8 +77,6 @@ jobs: - name: Create pull request if: github.head_ref == env.RELEASE_BRANCH || github.event_name == 'workflow_dispatch' - env: - PR_NUMBER: ${{ steps.create_pr.outputs.pull-request-number }} run: ./.ci/github/create_release_pull_request # release_sites: From 7e0f6b974c84ceb34ac62d224d7b01623917ba9e Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 11:36:53 -0500 Subject: [PATCH 44/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 9252a9f743..a65a817216 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -68,6 +68,7 @@ jobs: create_pull_request: needs: [get_next_release_version] + if: ${{ always() && !failure() && !cancelled() }} env: RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }} runs-on: ubuntu-latest From db088276a10142e5b36f26a91a30f4dde7fe4e03 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 12:02:26 -0500 Subject: [PATCH 45/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index a65a817216..faf4cdd7f8 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -68,7 +68,7 @@ jobs: create_pull_request: needs: [get_next_release_version] - if: ${{ always() && !failure() && !cancelled() }} + if: ${{ always() }} env: RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }} runs-on: ubuntu-latest From 6aae7bcdec105fbca4abc4e8af7eee8ea8c9433f Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 12:05:56 -0500 Subject: [PATCH 46/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index faf4cdd7f8..ba33bb501f 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -77,7 +77,6 @@ jobs: uses: actions/checkout@v4 - name: Create pull request - if: github.head_ref == env.RELEASE_BRANCH || github.event_name == 'workflow_dispatch' run: ./.ci/github/create_release_pull_request # release_sites: From bb0d718f57625a8461108afcb6130fc0381da88e Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 12:11:08 -0500 Subject: [PATCH 47/69] make executable --- .ci/github/deploy_release_sites | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .ci/github/deploy_release_sites diff --git a/.ci/github/deploy_release_sites b/.ci/github/deploy_release_sites old mode 100644 new mode 100755 From 0ebabea4142e1b71793e7d1697b6530f51a08ffb Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 14:59:55 -0500 Subject: [PATCH 48/69] Update deploy_release_sites --- .ci/github/deploy_release_sites | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.ci/github/deploy_release_sites b/.ci/github/deploy_release_sites index 383e20c87c..8776fe0324 100755 --- a/.ci/github/deploy_release_sites +++ b/.ci/github/deploy_release_sites @@ -2,8 +2,7 @@ set -eo pipefail -# Authenticate with Terminus and install Terminus Build Bools. -terminus -n auth:login --machine-token="$TERMINUS_TOKEN" +# Install Terminus Build Bools. terminus self:plugin:install terminus-build-tools-plugin # Get release sites and convert to an array. @@ -16,7 +15,7 @@ if [ "$RELEASE_BRANCH" ]; then #gh variable set RELEASE_BRANCH --body "$RELEASE_BRANCH" # Prepare output file for comment. - echo "Environments for review:" >> /tmp/multidev_output.txt + echo "Environments for review:" >> ${{ runner.temp }}/multidev_output.txt else echo "test" # Get release branch if already set. @@ -60,7 +59,7 @@ process_site() { # Get site URL and output to file site_url=$(terminus -n domain:list "$site_machine_name"."$RELEASE_BRANCH" --filter='type=platform' --field=id) - echo "- https://$site_url" >> /tmp/multidev_output.txt + echo "- https://$site_url" >> ${{ runner.temp }}/multidev_output.txt } # Export functions so that GNU Parallel can access them @@ -70,7 +69,7 @@ export -f process_site parallel --keep-order --line-buffer process_site {} ::: "${sites[@]}" # If we are creating the PR for the first time, post a comment with the created site URLs. -gh issue comment "$PR_NUMBER" --body-file /tmp/multidev_output.txt +gh issue comment "$PR_NUMBER" --body-file ${{ runner.temp }}/multidev_output.txt # TODO: after PR closed, delete multidevs # TODO: support new commits, push new code to multidevs From d835ebc1d4b33895c330b67bab8e28879a4ee2f4 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 15:00:03 -0500 Subject: [PATCH 49/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 68 ++++++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index ba33bb501f..eed36f7b71 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -79,16 +79,60 @@ jobs: - name: Create pull request run: ./.ci/github/create_release_pull_request - # release_sites: - # needs: [create_pull_request] - # runs-on: ubuntu-latest - # env: - # RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }} - # steps: - # - name: Checkout - # uses: actions/checkout@v4 - # with: - # ref: ${{ env.RELEASE_BRANCH }} + release_sites: + needs: [create_pull_request] + runs-on: ubuntu-latest + env: + RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ env.RELEASE_BRANCH }} + + - name: Determine Terminus version + shell: bash + run: | + TERMINUS_RELEASE=$( + curl --silent \ + --header 'authorization: Bearer ${{ github.token }}' \ + "https://api.github.com/repos/pantheon-systems/terminus/releases/latest" \ + | perl -nle'print $& while m#"tag_name": "\K[^"]*#g' + ) + echo "TERMINUS_RELEASE=$TERMINUS_RELEASE" >> $GITHUB_ENV + + - name: Install Terminus + shell: bash + run: | + mkdir ~/terminus && cd ~/terminus + echo "Installing Terminus v$TERMINUS_RELEASE" + curl -L https://github.com/pantheon-systems/terminus/releases/download/$TERMINUS_RELEASE/terminus.phar -o /usr/local/bin/terminus + chmod +x /usr/local/bin/terminus + + - name: Authenticate to Terminus + env: + TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }} + run: | + terminus auth:login --machine-token="${TERMINUS_TOKEN}" + + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.SSH_PRIVATE_KEY }} + known_hosts: unnecessary + config: ${{ secrets.SSH_CONFIG }} + + - name: Cache terminus + uses: actions/cache@v4 + id: terminus-cache + with: + path: | + /usr/local/bin/terminus + ~/.terminus + ~/.ssh + key: ${{ runner.os }}-terminus-cache-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-terminus-cache- - # - name: Deploy to environments - # run: ./.ci/github/deploy_release_sites + - name: Deploy to environments + run: ./.ci/github/deploy_release_sites From d4956e632c51a19bb2db207fc134fcdc9df6d24e Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 15:16:10 -0500 Subject: [PATCH 50/69] Update create_release_pull_request --- .ci/github/create_release_pull_request | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ci/github/create_release_pull_request b/.ci/github/create_release_pull_request index 51539c29d5..f11530d777 100755 --- a/.ci/github/create_release_pull_request +++ b/.ci/github/create_release_pull_request @@ -23,6 +23,9 @@ if [[ -z "$PR_NUMBER" ]]; then # Extract the pull request number from the response. PR_NUMBER=$(echo "$pull_request_response" | jq -r '.number') + # Set PR_NUMBER for Github Actions. + echo PR_NUMBER="$PR_NUMBER" >> "$GITHUB_OUTPUT" + # If there is an existing PR number, get the PR. else pull_request_response=$(curl --silent -H "Authorization: token $ACCESS_TOKEN" \ From 175deeb397dbf99a08cda6eeef8bd938b0a2509f Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 15:16:17 -0500 Subject: [PATCH 51/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index eed36f7b71..c325a34dc9 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -120,7 +120,6 @@ jobs: with: key: ${{ secrets.SSH_PRIVATE_KEY }} known_hosts: unnecessary - config: ${{ secrets.SSH_CONFIG }} - name: Cache terminus uses: actions/cache@v4 From 73c6c1713d86bde1435e5b7f7297b0b1ce762a6b Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 15:24:38 -0500 Subject: [PATCH 52/69] Update deploy_release_sites --- .ci/github/deploy_release_sites | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/github/deploy_release_sites b/.ci/github/deploy_release_sites index 8776fe0324..b8b71235f7 100755 --- a/.ci/github/deploy_release_sites +++ b/.ci/github/deploy_release_sites @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x set -eo pipefail @@ -15,7 +15,7 @@ if [ "$RELEASE_BRANCH" ]; then #gh variable set RELEASE_BRANCH --body "$RELEASE_BRANCH" # Prepare output file for comment. - echo "Environments for review:" >> ${{ runner.temp }}/multidev_output.txt + echo "Environments ready for review:" >> ${{ runner.temp }}/multidev_output.txt else echo "test" # Get release branch if already set. From 187c8bbfc4a1972a4d12b7740e6bb09a2e69cb9d Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 15:25:00 -0500 Subject: [PATCH 53/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index c325a34dc9..24f6a34ae8 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -80,7 +80,7 @@ jobs: run: ./.ci/github/create_release_pull_request release_sites: - needs: [create_pull_request] + needs: [get_next_release_version, create_pull_request] runs-on: ubuntu-latest env: RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }} From f1ff6dabd0dfaaec699c30268910e5aef425dcd7 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 15:35:43 -0500 Subject: [PATCH 54/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 24f6a34ae8..154c8fd2ae 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -13,6 +13,7 @@ env: REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.number }} RELEASE_PR_URL: ${{ github.event.pull_request._links.html.href }} + RUNNER_TEMP: ${{ runner.temp }} jobs: get_next_release_version: runs-on: ubuntu-latest From 7aa358af876e1b472a1ad8dcc889255a11fe6dfe Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 15:36:31 -0500 Subject: [PATCH 55/69] Update deploy_release_sites --- .ci/github/deploy_release_sites | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.ci/github/deploy_release_sites b/.ci/github/deploy_release_sites index b8b71235f7..7c3ce06d64 100755 --- a/.ci/github/deploy_release_sites +++ b/.ci/github/deploy_release_sites @@ -15,7 +15,7 @@ if [ "$RELEASE_BRANCH" ]; then #gh variable set RELEASE_BRANCH --body "$RELEASE_BRANCH" # Prepare output file for comment. - echo "Environments ready for review:" >> ${{ runner.temp }}/multidev_output.txt + echo "Environments ready for review:" >> "$RUNNER_TEMP"/multidev_output.txt else echo "test" # Get release branch if already set. @@ -59,7 +59,7 @@ process_site() { # Get site URL and output to file site_url=$(terminus -n domain:list "$site_machine_name"."$RELEASE_BRANCH" --filter='type=platform' --field=id) - echo "- https://$site_url" >> ${{ runner.temp }}/multidev_output.txt + echo "- https://$site_url" >> "$RUNNER_TEMP"/multidev_output.txt } # Export functions so that GNU Parallel can access them @@ -69,7 +69,7 @@ export -f process_site parallel --keep-order --line-buffer process_site {} ::: "${sites[@]}" # If we are creating the PR for the first time, post a comment with the created site URLs. -gh issue comment "$PR_NUMBER" --body-file ${{ runner.temp }}/multidev_output.txt +gh issue comment "$PR_NUMBER" --body-file "$RUNNER_TEMP"/multidev_output.txt # TODO: after PR closed, delete multidevs # TODO: support new commits, push new code to multidevs From 9908bf7e3e8c7e4f931a4cc8967d8ab62d2fbbc1 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 15:37:52 -0500 Subject: [PATCH 56/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 154c8fd2ae..cdb04b77a1 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -13,7 +13,6 @@ env: REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.number }} RELEASE_PR_URL: ${{ github.event.pull_request._links.html.href }} - RUNNER_TEMP: ${{ runner.temp }} jobs: get_next_release_version: runs-on: ubuntu-latest @@ -135,4 +134,6 @@ jobs: ${{ runner.os }}-terminus-cache- - name: Deploy to environments + env: + RUNNER_TEMP: ${{ runner.temp }} run: ./.ci/github/deploy_release_sites From a7e2341819a24761c18a1bf613d90118c1b7b639 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 15:48:36 -0500 Subject: [PATCH 57/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index cdb04b77a1..bdecd0cfa4 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -120,6 +120,7 @@ jobs: with: key: ${{ secrets.SSH_PRIVATE_KEY }} known_hosts: unnecessary + config: ${{ secrets.SSH_CONFIG }} - name: Cache terminus uses: actions/cache@v4 From 68b46f00c4e00009bb85f8fe88822d59ba47cf15 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 15:56:13 -0500 Subject: [PATCH 58/69] Update deploy_release_sites --- .ci/github/deploy_release_sites | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.ci/github/deploy_release_sites b/.ci/github/deploy_release_sites index 7c3ce06d64..5cefff2cb3 100755 --- a/.ci/github/deploy_release_sites +++ b/.ci/github/deploy_release_sites @@ -15,7 +15,7 @@ if [ "$RELEASE_BRANCH" ]; then #gh variable set RELEASE_BRANCH --body "$RELEASE_BRANCH" # Prepare output file for comment. - echo "Environments ready for review:" >> "$RUNNER_TEMP"/multidev_output.txt + echo "Environments ready for review:" >> output/multidev_output.txt else echo "test" # Get release branch if already set. @@ -59,7 +59,7 @@ process_site() { # Get site URL and output to file site_url=$(terminus -n domain:list "$site_machine_name"."$RELEASE_BRANCH" --filter='type=platform' --field=id) - echo "- https://$site_url" >> "$RUNNER_TEMP"/multidev_output.txt + echo "- https://$site_url" >> output/multidev_output.txt } # Export functions so that GNU Parallel can access them @@ -69,7 +69,7 @@ export -f process_site parallel --keep-order --line-buffer process_site {} ::: "${sites[@]}" # If we are creating the PR for the first time, post a comment with the created site URLs. -gh issue comment "$PR_NUMBER" --body-file "$RUNNER_TEMP"/multidev_output.txt +gh issue comment "$PR_NUMBER" --body-file output/multidev_output.txt # TODO: after PR closed, delete multidevs # TODO: support new commits, push new code to multidevs From 356ebdaf04710e9e436fdecb7d040d50a8d67288 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 16:00:22 -0500 Subject: [PATCH 59/69] Update deploy_release_sites --- .ci/github/deploy_release_sites | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.ci/github/deploy_release_sites b/.ci/github/deploy_release_sites index 5cefff2cb3..b85f286a2c 100755 --- a/.ci/github/deploy_release_sites +++ b/.ci/github/deploy_release_sites @@ -15,7 +15,7 @@ if [ "$RELEASE_BRANCH" ]; then #gh variable set RELEASE_BRANCH --body "$RELEASE_BRANCH" # Prepare output file for comment. - echo "Environments ready for review:" >> output/multidev_output.txt + echo "Environments ready for review:" >> output.txt else echo "test" # Get release branch if already set. @@ -59,7 +59,7 @@ process_site() { # Get site URL and output to file site_url=$(terminus -n domain:list "$site_machine_name"."$RELEASE_BRANCH" --filter='type=platform' --field=id) - echo "- https://$site_url" >> output/multidev_output.txt + echo "- https://$site_url" >> output.txt } # Export functions so that GNU Parallel can access them @@ -69,7 +69,7 @@ export -f process_site parallel --keep-order --line-buffer process_site {} ::: "${sites[@]}" # If we are creating the PR for the first time, post a comment with the created site URLs. -gh issue comment "$PR_NUMBER" --body-file output/multidev_output.txt +gh issue comment "$PR_NUMBER" --body-file output.txt # TODO: after PR closed, delete multidevs # TODO: support new commits, push new code to multidevs From d94320955f5b62c068000113f5e4f72a9ba2237b Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 16:15:24 -0500 Subject: [PATCH 60/69] Update deploy_release_sites --- .ci/github/deploy_release_sites | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.ci/github/deploy_release_sites b/.ci/github/deploy_release_sites index b85f286a2c..006777da8c 100755 --- a/.ci/github/deploy_release_sites +++ b/.ci/github/deploy_release_sites @@ -6,8 +6,8 @@ set -eo pipefail terminus self:plugin:install terminus-build-tools-plugin # Get release sites and convert to an array. -release_sites=$(gh api /repos/"$REPO"/actions/variables --jq '.variables.[] | select(.name=="RELEASE_SITES") | .value') -readarray -t sites <<< "$release_sites" +release_sites=$(gh api /repos/"$REPO"/actions/variables --jq '.variables.[] | select(.name=="RELEASE_SITES") | .value' | cat) +readarray -t sites_array <<< "$release_sites" # Release branch variable does not exist, so create multidevs for the first time. if [ "$RELEASE_BRANCH" ]; then @@ -66,7 +66,7 @@ process_site() { export -f push_code export -f process_site -parallel --keep-order --line-buffer process_site {} ::: "${sites[@]}" +parallel --keep-order --line-buffer process_site {} ::: "${sites_array[@]}" # If we are creating the PR for the first time, post a comment with the created site URLs. gh issue comment "$PR_NUMBER" --body-file output.txt From 1fe509d5fe30fe756670c7ebcddd7154a4a9ae1a Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Tue, 6 Feb 2024 20:51:39 -0500 Subject: [PATCH 61/69] Update deploy_release_sites --- .ci/github/deploy_release_sites | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/github/deploy_release_sites b/.ci/github/deploy_release_sites index 006777da8c..d274fb226f 100755 --- a/.ci/github/deploy_release_sites +++ b/.ci/github/deploy_release_sites @@ -6,7 +6,7 @@ set -eo pipefail terminus self:plugin:install terminus-build-tools-plugin # Get release sites and convert to an array. -release_sites=$(gh api /repos/"$REPO"/actions/variables --jq '.variables.[] | select(.name=="RELEASE_SITES") | .value' | cat) +release_sites=$(gh api /repos/"$REPO"/actions/variables --jq '.variables.[] | select(.name=="RELEASE_SITES") | .value' | tr -d '\r') readarray -t sites_array <<< "$release_sites" # Release branch variable does not exist, so create multidevs for the first time. From e724de8a10e866b3a804d9ff0e743a0a2535a865 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Wed, 7 Feb 2024 09:46:35 -0500 Subject: [PATCH 62/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index bdecd0cfa4..625c79bd77 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -69,6 +69,8 @@ jobs: create_pull_request: needs: [get_next_release_version] if: ${{ always() }} + outputs: + PR_NUMBER: ${{ steps.create_pull_request.outputs.PR_NUMBER }} env: RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }} runs-on: ubuntu-latest @@ -77,6 +79,7 @@ jobs: uses: actions/checkout@v4 - name: Create pull request + id: create_pull_request run: ./.ci/github/create_release_pull_request release_sites: @@ -84,6 +87,7 @@ jobs: runs-on: ubuntu-latest env: RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }} + PR_NUMBER: ${{ needs.create_pull_request.outputs.PR_NUMBER }} steps: - name: Checkout uses: actions/checkout@v4 From fc35268f249f426a522e7fe8b115eea84011aa3e Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Wed, 7 Feb 2024 09:55:36 -0500 Subject: [PATCH 63/69] Update deploy_release_sites --- .ci/github/deploy_release_sites | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/github/deploy_release_sites b/.ci/github/deploy_release_sites index d274fb226f..850a036260 100755 --- a/.ci/github/deploy_release_sites +++ b/.ci/github/deploy_release_sites @@ -66,7 +66,7 @@ process_site() { export -f push_code export -f process_site -parallel --keep-order --line-buffer process_site {} ::: "${sites_array[@]}" +parallel --jobs 0 --keep-order --line-buffer process_site {} ::: "${sites_array[@]}" # If we are creating the PR for the first time, post a comment with the created site URLs. gh issue comment "$PR_NUMBER" --body-file output.txt From 163ce64ebfc79919799386fc7386bbea350110b6 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Wed, 7 Feb 2024 12:38:18 -0500 Subject: [PATCH 64/69] Update deploy_release_sites --- .ci/github/deploy_release_sites | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.ci/github/deploy_release_sites b/.ci/github/deploy_release_sites index 850a036260..b3fe09805d 100755 --- a/.ci/github/deploy_release_sites +++ b/.ci/github/deploy_release_sites @@ -6,8 +6,7 @@ set -eo pipefail terminus self:plugin:install terminus-build-tools-plugin # Get release sites and convert to an array. -release_sites=$(gh api /repos/"$REPO"/actions/variables --jq '.variables.[] | select(.name=="RELEASE_SITES") | .value' | tr -d '\r') -readarray -t sites_array <<< "$release_sites" +readarray -t sites_array <<< "$(tr -d '\r' <<< "$RELEASE_SITES")" # Release branch variable does not exist, so create multidevs for the first time. if [ "$RELEASE_BRANCH" ]; then From 28412a24b767ab8cf0cad0864a9a74884cedaed5 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Wed, 7 Feb 2024 15:02:36 -0500 Subject: [PATCH 65/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 121 ++++++++++++++++++++----------- 1 file changed, 80 insertions(+), 41 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 625c79bd77..262105f875 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -3,6 +3,7 @@ on: pull_request: types: - synchronize + - closed branches: - master workflow_dispatch: @@ -14,11 +15,56 @@ env: PR_NUMBER: ${{ github.event.number }} RELEASE_PR_URL: ${{ github.event.pull_request._links.html.href }} jobs: + setup: + runs-on: ubuntu-latest + steps: + - name: Determine Terminus version + shell: bash + run: | + TERMINUS_RELEASE=$( + curl --silent \ + --header 'authorization: Bearer ${{ github.token }}' \ + "https://api.github.com/repos/pantheon-systems/terminus/releases/latest" \ + | perl -nle'print $& while m#"tag_name": "\K[^"]*#g' + ) + echo "TERMINUS_RELEASE=$TERMINUS_RELEASE" >> $GITHUB_ENV + + - name: Install Terminus + shell: bash + run: | + mkdir ~/terminus && cd ~/terminus + echo "Installing Terminus v$TERMINUS_RELEASE" + curl -L https://github.com/pantheon-systems/terminus/releases/download/$TERMINUS_RELEASE/terminus.phar -o /usr/local/bin/terminus + chmod +x /usr/local/bin/terminus + + - name: Authenticate to Terminus + env: + TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }} + run: | + terminus auth:login --machine-token="${TERMINUS_TOKEN}" + + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.SSH_PRIVATE_KEY }} + known_hosts: unnecessary + config: ${{ secrets.SSH_CONFIG }} + + - name: Cache terminus + uses: actions/cache@v4 + id: terminus-cache + with: + path: | + /usr/local/bin/terminus + ~/.terminus + ~/.ssh + key: ${{ runner.os }}-terminus-cache-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-terminus-cache- + get_next_release_version: runs-on: ubuntu-latest - if: ${{ github.event.action != 'synchronize' }} - outputs: - release_branch: ${{ steps.get_release_number.outputs.release_branch }} + if: ${{ github.event.action != 'synchronize' && github.event.action != 'closed' }} steps: - name: Checkout uses: actions/checkout@v4 @@ -57,10 +103,13 @@ jobs: fi echo release_branch="$release_branch" >> "$GITHUB_OUTPUT" + # Set release branch as a variable for access. + gh variable set RELEASE_BRANCH --body "$ENV_VALUE" + - name: Create release branch if: ${{ github.event.number == '' }} env: - RELEASE_BRANCH: ${{ steps.get_release_number.outputs.release_branch }} + RELEASE_BRANCH: ${{ vars.RELEASE_BRANCH }} run: | echo "The release branch is: $RELEASE_BRANCH" git checkout -b "$RELEASE_BRANCH" @@ -68,11 +117,11 @@ jobs: create_pull_request: needs: [get_next_release_version] - if: ${{ always() }} + if: ${{ always() && github.event.action != 'closed' }} outputs: PR_NUMBER: ${{ steps.create_pull_request.outputs.PR_NUMBER }} env: - RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }} + RELEASE_BRANCH: ${{ vars.RELEASE_BRANCH }} runs-on: ubuntu-latest steps: - name: Checkout @@ -85,48 +134,32 @@ jobs: release_sites: needs: [get_next_release_version, create_pull_request] runs-on: ubuntu-latest + if: ${{ github.event.action != 'closed' }} env: - RELEASE_BRANCH: ${{ needs.get_next_release_version.outputs.release_branch }} + RELEASE_BRANCH: ${{ vars.RELEASE_BRANCH }} PR_NUMBER: ${{ needs.create_pull_request.outputs.PR_NUMBER }} + RELEASE_SITES: ${{ vars.RELEASE_SITES }} steps: - name: Checkout uses: actions/checkout@v4 with: ref: ${{ env.RELEASE_BRANCH }} - - name: Determine Terminus version - shell: bash - run: | - TERMINUS_RELEASE=$( - curl --silent \ - --header 'authorization: Bearer ${{ github.token }}' \ - "https://api.github.com/repos/pantheon-systems/terminus/releases/latest" \ - | perl -nle'print $& while m#"tag_name": "\K[^"]*#g' - ) - echo "TERMINUS_RELEASE=$TERMINUS_RELEASE" >> $GITHUB_ENV - - - name: Install Terminus - shell: bash - run: | - mkdir ~/terminus && cd ~/terminus - echo "Installing Terminus v$TERMINUS_RELEASE" - curl -L https://github.com/pantheon-systems/terminus/releases/download/$TERMINUS_RELEASE/terminus.phar -o /usr/local/bin/terminus - chmod +x /usr/local/bin/terminus - - - name: Authenticate to Terminus - env: - TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }} + - name: Git setup run: | - terminus auth:login --machine-token="${TERMINUS_TOKEN}" + git config user.name github-actions + git config user.email github-actions@github.com - - name: Install SSH key - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.SSH_PRIVATE_KEY }} - known_hosts: unnecessary - config: ${{ secrets.SSH_CONFIG }} + - name: Deploy to environments + run: ./.ci/github/deploy_release_sites - - name: Cache terminus + clean_up: + if: ${{ github.event.action == 'closed' }} + runs-on: ubuntu-latest + env: + RELEASE_BRANCH: ${{ vars.RELEASE_BRANCH }} + steps: + - name: Restore cache uses: actions/cache@v4 id: terminus-cache with: @@ -138,7 +171,13 @@ jobs: restore-keys: | ${{ runner.os }}-terminus-cache- - - name: Deploy to environments - env: - RUNNER_TEMP: ${{ runner.temp }} - run: ./.ci/github/deploy_release_sites + - name: Clean up + run: | + process_site() { + site_with_env="$1" + site_machine_name="${site_with_env%.*}" + terminus multidev:delete "$site_with_env"."$RELEASE_BRANCH" --delete-branch -y + } + export process_site + readarray -t release_sites <<< "$(tr -d '\r' <<< "$RELEASE_SITES")" + parallel --jobs 0 --keep-order --line-buffer process_site ::: "${release_sites[@]}" From 4691a22a1f437a13c97b401f5c69bd7c9bdd4737 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Wed, 7 Feb 2024 15:09:16 -0500 Subject: [PATCH 66/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 262105f875..92a1a4d64a 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -64,6 +64,7 @@ jobs: get_next_release_version: runs-on: ubuntu-latest + needs: [setup] if: ${{ github.event.action != 'synchronize' && github.event.action != 'closed' }} steps: - name: Checkout @@ -101,10 +102,10 @@ jobs: release_branch="v${next_version//.}" fi fi - echo release_branch="$release_branch" >> "$GITHUB_OUTPUT" + # echo release_branch="$release_branch" >> "$GITHUB_OUTPUT" # Set release branch as a variable for access. - gh variable set RELEASE_BRANCH --body "$ENV_VALUE" + gh variable set RELEASE_BRANCH --body "$release_branch" - name: Create release branch if: ${{ github.event.number == '' }} @@ -116,7 +117,7 @@ jobs: git push origin "$RELEASE_BRANCH" create_pull_request: - needs: [get_next_release_version] + needs: [setup, get_next_release_version] if: ${{ always() && github.event.action != 'closed' }} outputs: PR_NUMBER: ${{ steps.create_pull_request.outputs.PR_NUMBER }} @@ -132,7 +133,7 @@ jobs: run: ./.ci/github/create_release_pull_request release_sites: - needs: [get_next_release_version, create_pull_request] + needs: [setup, get_next_release_version, create_pull_request] runs-on: ubuntu-latest if: ${{ github.event.action != 'closed' }} env: @@ -155,6 +156,7 @@ jobs: clean_up: if: ${{ github.event.action == 'closed' }} + needs: [setup] runs-on: ubuntu-latest env: RELEASE_BRANCH: ${{ vars.RELEASE_BRANCH }} From 278ac9df338b91167c7c4264e1ce4d07c71cef80 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Wed, 7 Feb 2024 15:14:07 -0500 Subject: [PATCH 67/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 92a1a4d64a..4bfdc9e14b 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -151,6 +151,18 @@ jobs: git config user.name github-actions git config user.email github-actions@github.com + - name: Restore cache + uses: actions/cache@v4 + id: terminus-cache + with: + path: | + /usr/local/bin/terminus + ~/.terminus + ~/.ssh + key: ${{ runner.os }}-terminus-cache-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-terminus-cache- + - name: Deploy to environments run: ./.ci/github/deploy_release_sites From 0857a20a03e5e61e1c075a8d5d4355e44b986640 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Wed, 7 Feb 2024 15:27:48 -0500 Subject: [PATCH 68/69] add cleanup file --- .ci/github/clean_up | 74 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 .ci/github/clean_up diff --git a/.ci/github/clean_up b/.ci/github/clean_up new file mode 100755 index 0000000000..b3fe09805d --- /dev/null +++ b/.ci/github/clean_up @@ -0,0 +1,74 @@ +#!/bin/bash -x + +set -eo pipefail + +# Install Terminus Build Bools. +terminus self:plugin:install terminus-build-tools-plugin + +# Get release sites and convert to an array. +readarray -t sites_array <<< "$(tr -d '\r' <<< "$RELEASE_SITES")" + +# Release branch variable does not exist, so create multidevs for the first time. +if [ "$RELEASE_BRANCH" ]; then + # Set release branch. + #gh variable set RELEASE_BRANCH --body "$RELEASE_BRANCH" + + # Prepare output file for comment. + echo "Environments ready for review:" >> output.txt +else + echo "test" + # Get release branch if already set. + #release_branch=$(gh api /repos/"$REPO"/actions/variables --jq '.variables.[] | select(.name=="RELEASE_BRANCH") | .value') +fi + +push_code() { + git_path=$(terminus connection:info "$site_with_env" --field=git_url) + git remote add "$site_machine_name" "$git_path" + git fetch "$site_machine_name" + git push "$site_machine_name" "$RELEASE_BRANCH:$RELEASE_BRANCH" --force + terminus workflow:wait "$site_machine_name"."$RELEASE_BRANCH" --max=300 +} + +process_site() { + site_with_env="$1" + site_machine_name="${site_with_env%.*}" + + echo -e "\nCreating multidev $site_machine_name.$RELEASE_BRANCH from $site_with_env...\n" + + if [ "$site_machine_name" = "yalesites-platform" ]; then + terminus multidev:create "$site_with_env" "$RELEASE_BRANCH" --no-db --no-files + else + terminus multidev:create "$site_with_env" "$RELEASE_BRANCH" + fi + + push_code + + # Do a fresh install on yalesites-platform site. + if [ "$site_machine_name" = "yalesites-platform" ]; then + echo -e "\nInstalling clean site for $site_machine_name.$RELEASE_BRANCH...\n" + terminus -n env:wake "$site_machine_name"."$RELEASE_BRANCH" + terminus -n drush "$site_machine_name"."$RELEASE_BRANCH" -- si yalesites_profile -y + terminus -n drush "$site_machine_name"."$RELEASE_BRANCH" -- cr + SITE_MACHINE_NAME="$site_machine_name" env="$RELEASE_BRANCH" ./scripts/shared/content-import.sh + fi + + terminus -n env:wake "$site_machine_name"."$RELEASE_BRANCH" + echo -e "\nRunning drush deploy...\n" + terminus -n drush "$site_machine_name"."$RELEASE_BRANCH" -- deploy -v -y + + # Get site URL and output to file + site_url=$(terminus -n domain:list "$site_machine_name"."$RELEASE_BRANCH" --filter='type=platform' --field=id) + echo "- https://$site_url" >> output.txt +} + +# Export functions so that GNU Parallel can access them +export -f push_code +export -f process_site + +parallel --jobs 0 --keep-order --line-buffer process_site {} ::: "${sites_array[@]}" + +# If we are creating the PR for the first time, post a comment with the created site URLs. +gh issue comment "$PR_NUMBER" --body-file output.txt + +# TODO: after PR closed, delete multidevs +# TODO: support new commits, push new code to multidevs From 2657fc23d9c0af623cad8ba877dd043085e2ed5f Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Wed, 7 Feb 2024 15:27:59 -0500 Subject: [PATCH 69/69] Update release_pr.yml --- .github/workflows/release_pr.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 4bfdc9e14b..88b15e53dd 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -14,6 +14,7 @@ env: REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.number }} RELEASE_PR_URL: ${{ github.event.pull_request._links.html.href }} + RELEASE_SITES: ${{ vars.RELEASE_SITES }} jobs: setup: runs-on: ubuntu-latest @@ -139,7 +140,6 @@ jobs: env: RELEASE_BRANCH: ${{ vars.RELEASE_BRANCH }} PR_NUMBER: ${{ needs.create_pull_request.outputs.PR_NUMBER }} - RELEASE_SITES: ${{ vars.RELEASE_SITES }} steps: - name: Checkout uses: actions/checkout@v4 @@ -186,12 +186,4 @@ jobs: ${{ runner.os }}-terminus-cache- - name: Clean up - run: | - process_site() { - site_with_env="$1" - site_machine_name="${site_with_env%.*}" - terminus multidev:delete "$site_with_env"."$RELEASE_BRANCH" --delete-branch -y - } - export process_site - readarray -t release_sites <<< "$(tr -d '\r' <<< "$RELEASE_SITES")" - parallel --jobs 0 --keep-order --line-buffer process_site ::: "${release_sites[@]}" + run: ./.ci/github/clean_up