From 34e634d711b73f653776fc9fc598391e9f2bfc7c Mon Sep 17 00:00:00 2001 From: Simon Schrottner Date: Wed, 8 Mar 2023 13:03:25 +0100 Subject: [PATCH 1/7] fix: add example release logic Signed-off-by: Simon Schrottner --- .github/workflows/release-examples.yml | 55 ++++++++++++++++++++++++++ .github/workflows/release.yml | 9 +++++ 2 files changed, 64 insertions(+) create mode 100644 .github/workflows/release-examples.yml diff --git a/.github/workflows/release-examples.yml b/.github/workflows/release-examples.yml new file mode 100644 index 0000000000..6cd99aed60 --- /dev/null +++ b/.github/workflows/release-examples.yml @@ -0,0 +1,55 @@ +name: Release Documentation + +on: + workflow_call: + inputs: + tag_name: + description: "Tag for the functions runner image" + type: "string" + required: true + examples_dir: + description: "Root directory of the website" + type: "string" + required: false + default: "./tmp/examples/" + dry_run: + description: "Flag for testing" + type: "boolean" + default: false + required: false + +jobs: + release-docs: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Checkout - page branch + uses: actions/checkout@v3 + with: + repository: keptn-sandbox/lifecycle-toolkit-examples + path: ${{ inputs.page_dir }} + token: ${{ secrets.KEPTN_BOT_TOKEN }} + + - name: Get Latest Release Information + uses: octokit/request-action@v2.x + id: latest_release + with: + route: GET /repos/:owner/:repository/releases/latest + repository: lifecycle-toolkit + owner: keptn + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Move old latest release documentation folder + if: ${{ fromJson(steps.latest_release.outputs.data).tag_name == inputs.tag_name }} + run: cp -R ./examples/* "${{ inputs.examples_dir }}" + + - name: Push content + if: ${{ inputs.dry_run != true }} + uses: EndBug/add-and-commit@v9 + with: + default_author: github_actions + cwd: ${{ inputs.page_dir }} + message: "releasing examples ${{ inputs.tag_name }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 505bbd6951..a1714ed0fc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -194,3 +194,12 @@ jobs: with: tag_name: ${{ needs.release-please.outputs.tag_name }} uses: ./.github/workflows/release-docs.yml + + update-examples: + name: Update examples + needs: + - release-please + if: needs.release-please.outputs.releases_created == 'true' + with: + tag_name: ${{ needs.release-please.outputs.tag_name }} + uses: ./.github/workflows/release-examples.yml From 3dcf13c3ccea232bafaf459562d4f5257cab9cde Mon Sep 17 00:00:00 2001 From: Simon Schrottner Date: Thu, 9 Mar 2023 15:17:56 +0100 Subject: [PATCH 2/7] Apply suggestions from code review Co-authored-by: Moritz Wiesinger Signed-off-by: Simon Schrottner --- .github/workflows/release-examples.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-examples.yml b/.github/workflows/release-examples.yml index 6cd99aed60..ea1441f0d0 100644 --- a/.github/workflows/release-examples.yml +++ b/.github/workflows/release-examples.yml @@ -51,5 +51,5 @@ jobs: uses: EndBug/add-and-commit@v9 with: default_author: github_actions - cwd: ${{ inputs.page_dir }} - message: "releasing examples ${{ inputs.tag_name }}" + cwd: ${{ inputs.examples_dir }} + message: "feat: release examples ${{ inputs.tag_name }}" From c7a5f48f43857a8d771f77b570d2eda69727d832 Mon Sep 17 00:00:00 2001 From: Simon Schrottner Date: Thu, 23 Mar 2023 10:10:37 +0100 Subject: [PATCH 3/7] Update .github/workflows/release-examples.yml Signed-off-by: Simon Schrottner --- .github/workflows/release-examples.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-examples.yml b/.github/workflows/release-examples.yml index ea1441f0d0..5fa9e2e752 100644 --- a/.github/workflows/release-examples.yml +++ b/.github/workflows/release-examples.yml @@ -1,4 +1,4 @@ -name: Release Documentation +name: Release Examples on: workflow_call: From b6e4b91a87ba3203baa263caa6c7cfb5c7dbd633 Mon Sep 17 00:00:00 2001 From: Simon Schrottner Date: Thu, 23 Mar 2023 10:10:54 +0100 Subject: [PATCH 4/7] Update .github/workflows/release-examples.yml Signed-off-by: Simon Schrottner --- .github/workflows/release-examples.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-examples.yml b/.github/workflows/release-examples.yml index 5fa9e2e752..2f6dfb0bf4 100644 --- a/.github/workflows/release-examples.yml +++ b/.github/workflows/release-examples.yml @@ -8,7 +8,7 @@ on: type: "string" required: true examples_dir: - description: "Root directory of the website" + description: "Root directory of the examples" type: "string" required: false default: "./tmp/examples/" From 9ebb0bb61a86c1a91e47d402e8e5898fb6b90966 Mon Sep 17 00:00:00 2001 From: Simon Schrottner Date: Thu, 23 Mar 2023 10:14:20 +0100 Subject: [PATCH 5/7] Update .github/workflows/release-examples.yml Signed-off-by: Simon Schrottner --- .github/workflows/release-examples.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-examples.yml b/.github/workflows/release-examples.yml index 2f6dfb0bf4..99b8557dc6 100644 --- a/.github/workflows/release-examples.yml +++ b/.github/workflows/release-examples.yml @@ -53,3 +53,4 @@ jobs: default_author: github_actions cwd: ${{ inputs.examples_dir }} message: "feat: release examples ${{ inputs.tag_name }}" + tag: "${{ inputs.tag_name }}" From bb729a67798dd7860d720e0a7ece66319ae9df55 Mon Sep 17 00:00:00 2001 From: Simon Schrottner Date: Thu, 23 Mar 2023 12:13:05 +0100 Subject: [PATCH 6/7] Apply suggestions from code review Co-authored-by: Moritz Wiesinger Signed-off-by: Simon Schrottner --- .github/workflows/release-examples.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-examples.yml b/.github/workflows/release-examples.yml index 99b8557dc6..02c7659cae 100644 --- a/.github/workflows/release-examples.yml +++ b/.github/workflows/release-examples.yml @@ -25,15 +25,15 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Checkout - page branch + - name: Checkout examples repo uses: actions/checkout@v3 with: repository: keptn-sandbox/lifecycle-toolkit-examples - path: ${{ inputs.page_dir }} + path: ${{ inputs.examples_dir }} token: ${{ secrets.KEPTN_BOT_TOKEN }} - name: Get Latest Release Information - uses: octokit/request-action@v2.x + uses: octokit/request-action@v2.1.7 id: latest_release with: route: GET /repos/:owner/:repository/releases/latest @@ -42,12 +42,12 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Move old latest release documentation folder + - name: Move old latest release examples folder if: ${{ fromJson(steps.latest_release.outputs.data).tag_name == inputs.tag_name }} run: cp -R ./examples/* "${{ inputs.examples_dir }}" - name: Push content - if: ${{ inputs.dry_run != true }} + if: inputs.dry_run != true uses: EndBug/add-and-commit@v9 with: default_author: github_actions From 65d221df9354dc1f1ace4e21dc737b8cc4db7bf0 Mon Sep 17 00:00:00 2001 From: Simon Schrottner Date: Thu, 23 Mar 2023 13:05:16 +0100 Subject: [PATCH 7/7] updating file, adding dry run Signed-off-by: Simon Schrottner --- .github/workflows/release-examples.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-examples.yml b/.github/workflows/release-examples.yml index 02c7659cae..9b8477c34f 100644 --- a/.github/workflows/release-examples.yml +++ b/.github/workflows/release-examples.yml @@ -4,7 +4,7 @@ on: workflow_call: inputs: tag_name: - description: "Tag for the functions runner image" + description: "Tag for the release being created" type: "string" required: true examples_dir: @@ -19,7 +19,7 @@ on: required: false jobs: - release-docs: + release-examples: runs-on: ubuntu-22.04 steps: - name: Checkout @@ -43,7 +43,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Move old latest release examples folder - if: ${{ fromJson(steps.latest_release.outputs.data).tag_name == inputs.tag_name }} + if: ${{ fromJson(steps.latest_release.outputs.data).tag_name == inputs.tag_name }} run: cp -R ./examples/* "${{ inputs.examples_dir }}" - name: Push content