From 451ebf1d57d650c18ceb50554696768cf5b4c71c Mon Sep 17 00:00:00 2001 From: David Fluck Date: Wed, 23 Oct 2024 16:49:19 -0400 Subject: [PATCH 01/15] INFENG-933: Add start-minor-release GitHub action. Add GitHub action to start a minor release. This is necessary, temporarily, to run both lock-api-state.sh and lock-published-urls.sh, until we can figure out a way to make those same guarantees without committing directly to main every time we do a minor release. This basically just reproduces a small part of rph, but with GitHub actions instead. --- .github/workflows/start-release.yml | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/start-release.yml diff --git a/.github/workflows/start-release.yml b/.github/workflows/start-release.yml new file mode 100644 index 00000000000..11e66c7ff05 --- /dev/null +++ b/.github/workflows/start-release.yml @@ -0,0 +1,30 @@ +--- +name: start-minor-release + +on: # yamllint disable-line rule:truthy + workflow_dispatch: + inputs: + version: + description: "The Determined minor version to release. E.g. 0.38.0. This will create a new release branch and make commits on main." + required: true + +jobs: + start-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: validate version + run: | + grep -E -o '[0-9]+\.[0-9]+\.0' <(printf "%s" '${{ github.event.inputs.version }}') && true + - name: create branch + run: | + echo 'Creating branch: release-${{ github.event.inputs.version }}' + git checkout -b release-${{ github.event.inputs.version }} + - name: switch back to main + run: | + git checkout main + - name: publish changes to main + run: | + ./tools/scripts/lock-api-state.sh + ./tools/scripts/lock-published-urls.sh + git push origin main From b68b7385b9ffe376bcf4ed9d43b8ce993f1e95a6 Mon Sep 17 00:00:00 2001 From: David Fluck Date: Wed, 23 Oct 2024 17:01:43 -0400 Subject: [PATCH 02/15] Add quotes around a bunch of strings, because YAML makes me nervous. Add steps to install Go and the buf/protobuf dependencies. Add some helpful newlines for readability. --- .github/workflows/start-release.yml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/start-release.yml b/.github/workflows/start-release.yml index 11e66c7ff05..bd89e5b2a15 100644 --- a/.github/workflows/start-release.yml +++ b/.github/workflows/start-release.yml @@ -1,5 +1,5 @@ --- -name: start-minor-release +name: "Start minor release" on: # yamllint disable-line rule:truthy workflow_dispatch: @@ -13,17 +13,29 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: validate version + + - name: "Validate version" run: | grep -E -o '[0-9]+\.[0-9]+\.0' <(printf "%s" '${{ github.event.inputs.version }}') && true - - name: create branch + + - name: "Setup Go" + uses: actions/setup-go@v5 + with: + go-version: "1.22.0" + + - name: "Install protobuf dependencies." + run: "make get-deps-proto" + + - name: "Create release branch" run: | echo 'Creating branch: release-${{ github.event.inputs.version }}' git checkout -b release-${{ github.event.inputs.version }} - - name: switch back to main + + - name: "Switch back to main" run: | git checkout main - - name: publish changes to main + + - name: "Publish changes to main" run: | ./tools/scripts/lock-api-state.sh ./tools/scripts/lock-published-urls.sh From c0075c42c3210d314e24d716c0597e627e4991b8 Mon Sep 17 00:00:00 2001 From: David Fluck Date: Wed, 23 Oct 2024 17:12:33 -0400 Subject: [PATCH 03/15] Set user.name and user.email correctly for GitHub actions committer. --- .github/workflows/start-release.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/start-release.yml b/.github/workflows/start-release.yml index bd89e5b2a15..16e24cdfb6e 100644 --- a/.github/workflows/start-release.yml +++ b/.github/workflows/start-release.yml @@ -35,6 +35,12 @@ jobs: run: | git checkout main + - name: "git config" + run: | + git config user.name github-actions + git config user.email \ + 41898282+github-actions[bot]@users.noreply.github.com + - name: "Publish changes to main" run: | ./tools/scripts/lock-api-state.sh From c1bc5915bd844962e4aa966e05864396b8af48e9 Mon Sep 17 00:00:00 2001 From: David Fluck Date: Wed, 23 Oct 2024 17:14:25 -0400 Subject: [PATCH 04/15] Adjust step to push release branch back up. --- .github/workflows/start-release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/start-release.yml b/.github/workflows/start-release.yml index 16e24cdfb6e..bf1ba6616f8 100644 --- a/.github/workflows/start-release.yml +++ b/.github/workflows/start-release.yml @@ -31,6 +31,9 @@ jobs: echo 'Creating branch: release-${{ github.event.inputs.version }}' git checkout -b release-${{ github.event.inputs.version }} + echo 'Pushing release branch' + git push -u origin release-${{ github.event.inputs.version }} + - name: "Switch back to main" run: | git checkout main From 8939b13ddccf68474338177a050b274903b40429 Mon Sep 17 00:00:00 2001 From: David Fluck Date: Wed, 23 Oct 2024 17:21:17 -0400 Subject: [PATCH 05/15] Move git config step further up and rename it. --- .github/workflows/start-release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/start-release.yml b/.github/workflows/start-release.yml index bf1ba6616f8..625d1c26531 100644 --- a/.github/workflows/start-release.yml +++ b/.github/workflows/start-release.yml @@ -18,6 +18,12 @@ jobs: run: | grep -E -o '[0-9]+\.[0-9]+\.0' <(printf "%s" '${{ github.event.inputs.version }}') && true + - name: Configure git username and e-mail" + run: | + git config user.name github-actions + git config user.email \ + 41898282+github-actions[bot]@users.noreply.github.com + - name: "Setup Go" uses: actions/setup-go@v5 with: @@ -38,12 +44,6 @@ jobs: run: | git checkout main - - name: "git config" - run: | - git config user.name github-actions - git config user.email \ - 41898282+github-actions[bot]@users.noreply.github.com - - name: "Publish changes to main" run: | ./tools/scripts/lock-api-state.sh From effd5284932eb73d796f76d2fc12265de8bbd318 Mon Sep 17 00:00:00 2001 From: David Fluck Date: Wed, 23 Oct 2024 17:28:29 -0400 Subject: [PATCH 06/15] Rename start-release.yml to start-minor-release.yml --- .github/workflows/{start-release.yml => start-minor-release.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{start-release.yml => start-minor-release.yml} (100%) diff --git a/.github/workflows/start-release.yml b/.github/workflows/start-minor-release.yml similarity index 100% rename from .github/workflows/start-release.yml rename to .github/workflows/start-minor-release.yml From 7e7259d78f581754f38348eb0e40f8ee9904597a Mon Sep 17 00:00:00 2001 From: David Fluck Date: Wed, 23 Oct 2024 17:34:37 -0400 Subject: [PATCH 07/15] Update job name. --- .github/workflows/start-minor-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/start-minor-release.yml b/.github/workflows/start-minor-release.yml index 625d1c26531..707a4a5819e 100644 --- a/.github/workflows/start-minor-release.yml +++ b/.github/workflows/start-minor-release.yml @@ -9,7 +9,7 @@ on: # yamllint disable-line rule:truthy required: true jobs: - start-release: + start-minor-release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 11a5e741a5aec639e4e2fd916ab2b144c8bed47a Mon Sep 17 00:00:00 2001 From: David Fluck Date: Wed, 23 Oct 2024 17:39:58 -0400 Subject: [PATCH 08/15] Switch to a more explicit error check for version string validity, and output something helpful if an error occurs. --- .github/workflows/start-minor-release.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/start-minor-release.yml b/.github/workflows/start-minor-release.yml index 707a4a5819e..f7da7153f37 100644 --- a/.github/workflows/start-minor-release.yml +++ b/.github/workflows/start-minor-release.yml @@ -16,7 +16,12 @@ jobs: - name: "Validate version" run: | - grep -E -o '[0-9]+\.[0-9]+\.0' <(printf "%s" '${{ github.event.inputs.version }}') && true + grep -E -o '[0-9]+\.[0-9]+\.0' <(printf "%s" '${{ github.event.inputs.version }}') + + ret = $? + if [[ $ret != 0 ]]; then + echo 'Version string must match <[0-9]+\.[0-9]+\.0>. Got: <${{ github.event.inputs.version }}>'; + exit $ret - name: Configure git username and e-mail" run: | From fa3b6295d9aaccbd1a7387336172f8615a136663 Mon Sep 17 00:00:00 2001 From: David Fluck Date: Wed, 23 Oct 2024 17:42:14 -0400 Subject: [PATCH 09/15] Use correct if/fi syntax. --- .github/workflows/start-minor-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/start-minor-release.yml b/.github/workflows/start-minor-release.yml index f7da7153f37..2ecbb3f74ce 100644 --- a/.github/workflows/start-minor-release.yml +++ b/.github/workflows/start-minor-release.yml @@ -22,6 +22,7 @@ jobs: if [[ $ret != 0 ]]; then echo 'Version string must match <[0-9]+\.[0-9]+\.0>. Got: <${{ github.event.inputs.version }}>'; exit $ret + fi - name: Configure git username and e-mail" run: | From cb5d7fa846768f8520e3662810ac7657f1e06366 Mon Sep 17 00:00:00 2001 From: David Fluck Date: Wed, 23 Oct 2024 17:44:21 -0400 Subject: [PATCH 10/15] Disable intermediate failure. --- .github/workflows/start-minor-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/start-minor-release.yml b/.github/workflows/start-minor-release.yml index 2ecbb3f74ce..a1ac7061129 100644 --- a/.github/workflows/start-minor-release.yml +++ b/.github/workflows/start-minor-release.yml @@ -15,12 +15,13 @@ jobs: - uses: actions/checkout@v4 - name: "Validate version" + shell: bash {0} run: | grep -E -o '[0-9]+\.[0-9]+\.0' <(printf "%s" '${{ github.event.inputs.version }}') ret = $? if [[ $ret != 0 ]]; then - echo 'Version string must match <[0-9]+\.[0-9]+\.0>. Got: <${{ github.event.inputs.version }}>'; + echo 'Version string must match <[0-9]+\.[0-9]+\.0>. Got: <${{ github.event.inputs.version }}>' exit $ret fi From 5868b582189a0bc64b906dafd7a5a89bd92ebcda Mon Sep 17 00:00:00 2001 From: David Fluck Date: Wed, 23 Oct 2024 17:47:07 -0400 Subject: [PATCH 11/15] Fix variable assignment syntax. Add ::error:: to error output on version string validation step. --- .github/workflows/start-minor-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/start-minor-release.yml b/.github/workflows/start-minor-release.yml index a1ac7061129..a284b8e8478 100644 --- a/.github/workflows/start-minor-release.yml +++ b/.github/workflows/start-minor-release.yml @@ -19,9 +19,9 @@ jobs: run: | grep -E -o '[0-9]+\.[0-9]+\.0' <(printf "%s" '${{ github.event.inputs.version }}') - ret = $? + ret=$? if [[ $ret != 0 ]]; then - echo 'Version string must match <[0-9]+\.[0-9]+\.0>. Got: <${{ github.event.inputs.version }}>' + echo '::error::Version string must match <[0-9]+\.[0-9]+\.0>. Got: <${{ github.event.inputs.version }}>' exit $ret fi From f589ffdc149c2920cfb25c1555d86935d14664fc Mon Sep 17 00:00:00 2001 From: David Fluck Date: Wed, 23 Oct 2024 17:57:58 -0400 Subject: [PATCH 12/15] Swap YAML string types. --- .github/workflows/start-minor-release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/start-minor-release.yml b/.github/workflows/start-minor-release.yml index a284b8e8478..1b7311bbb06 100644 --- a/.github/workflows/start-minor-release.yml +++ b/.github/workflows/start-minor-release.yml @@ -48,8 +48,7 @@ jobs: git push -u origin release-${{ github.event.inputs.version }} - name: "Switch back to main" - run: | - git checkout main + run: "git checkout main" - name: "Publish changes to main" run: | From a0c8f14743e577e63617516b013814cfcdcb686b Mon Sep 17 00:00:00 2001 From: David Fluck Date: Wed, 23 Oct 2024 18:00:05 -0400 Subject: [PATCH 13/15] nit: remove period from step name --- .github/workflows/start-minor-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/start-minor-release.yml b/.github/workflows/start-minor-release.yml index 1b7311bbb06..40698c91312 100644 --- a/.github/workflows/start-minor-release.yml +++ b/.github/workflows/start-minor-release.yml @@ -36,7 +36,7 @@ jobs: with: go-version: "1.22.0" - - name: "Install protobuf dependencies." + - name: "Install protobuf dependencies" run: "make get-deps-proto" - name: "Create release branch" From ef062570ed29a6d1b39be5be02c2199e608a5cad Mon Sep 17 00:00:00 2001 From: David Fluck Date: Wed, 23 Oct 2024 18:07:21 -0400 Subject: [PATCH 14/15] Switch printf "%s" to a herestring. --- .github/workflows/start-minor-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/start-minor-release.yml b/.github/workflows/start-minor-release.yml index 40698c91312..f476789c0f8 100644 --- a/.github/workflows/start-minor-release.yml +++ b/.github/workflows/start-minor-release.yml @@ -17,7 +17,7 @@ jobs: - name: "Validate version" shell: bash {0} run: | - grep -E -o '[0-9]+\.[0-9]+\.0' <(printf "%s" '${{ github.event.inputs.version }}') + grep -E -o '[0-9]+\.[0-9]+\.0' <<<'${{ github.event.inputs.version }}' ret=$? if [[ $ret != 0 ]]; then From 14bde9519e52dbb362712f46d0fb80f6976bbf4e Mon Sep 17 00:00:00 2001 From: David Fluck Date: Thu, 24 Oct 2024 11:47:09 -0400 Subject: [PATCH 15/15] Set explicit job name to remove pesky hyphens. Add GH_TOKEN env variable to use the DETERMINED_TOKEN secret, otherwise expect permissions issues when non-admins run the action. Add explicit contents: write permission. --- .github/workflows/start-minor-release.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/start-minor-release.yml b/.github/workflows/start-minor-release.yml index f476789c0f8..af06d7ece7d 100644 --- a/.github/workflows/start-minor-release.yml +++ b/.github/workflows/start-minor-release.yml @@ -10,6 +10,11 @@ on: # yamllint disable-line rule:truthy jobs: start-minor-release: + name: "Start minor release" + env: + GH_TOKEN: ${{ secrets.DETERMINED_TOKEN }} + permissions: + contents: write runs-on: ubuntu-latest steps: - uses: actions/checkout@v4