From 1bafd6845a5229aa511fca0ffbc98697cbe1cbb2 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 2 May 2023 15:23:48 +0300 Subject: [PATCH 01/44] first check Signed-off-by: Matan Avital --- .github/workflows/kubescape-cli-e2e-tests.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/kubescape-cli-e2e-tests.yaml b/.github/workflows/kubescape-cli-e2e-tests.yaml index 9c5fed2..edc2671 100644 --- a/.github/workflows/kubescape-cli-e2e-tests.yaml +++ b/.github/workflows/kubescape-cli-e2e-tests.yaml @@ -55,7 +55,9 @@ jobs: SECRET_KEY: ${{ secrets.SECRET_KEY_PROD }} REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} - run: "echo \"is-secret-set=${{ env.CUSTOMER != '' && \n env.USERNAME != '' &&\n env.PASSWORD != '' &&\n env.CLIENT_ID != '' &&\n env.SECRET_KEY != '' &&\n env.REGISTRY_USERNAME != '' &&\n env.REGISTRY_PASSWORD != ''\n }}\" >> $GITHUB_OUTPUT\n" + if: ${{ env.CUSTOMER == '' }} + run: 'echo "echo the secret \"MY_SECRET\" has not been made; echo please go to \"settings \> secrets \> actions\" to create it"' + # run: "echo \"is-secret-set=${{ env.CUSTOMER != '' && \n env.USERNAME != '' &&\n env.PASSWORD != '' &&\n env.CLIENT_ID != '' &&\n env.SECRET_KEY != '' &&\n env.REGISTRY_USERNAME != '' &&\n env.REGISTRY_PASSWORD != ''\n }}\" >> $GITHUB_OUTPUT\n" - id: export_tests_to_env name: set test name From 6fd01d91d07360350b4705b9b64f9aa0a8031dbf Mon Sep 17 00:00:00 2001 From: Matan Avital Date: Wed, 3 May 2023 16:48:29 +0300 Subject: [PATCH 02/44] added a secret validation mechanism Signed-off-by: Matan Avital --- .github/workflows/kubescape-cli-e2e-tests.yaml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/kubescape-cli-e2e-tests.yaml b/.github/workflows/kubescape-cli-e2e-tests.yaml index edc2671..9b9844d 100644 --- a/.github/workflows/kubescape-cli-e2e-tests.yaml +++ b/.github/workflows/kubescape-cli-e2e-tests.yaml @@ -55,9 +55,18 @@ jobs: SECRET_KEY: ${{ secrets.SECRET_KEY_PROD }} REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} - if: ${{ env.CUSTOMER == '' }} - run: 'echo "echo the secret \"MY_SECRET\" has not been made; echo please go to \"settings \> secrets \> actions\" to create it"' - # run: "echo \"is-secret-set=${{ env.CUSTOMER != '' && \n env.USERNAME != '' &&\n env.PASSWORD != '' &&\n env.CLIENT_ID != '' &&\n env.SECRET_KEY != '' &&\n env.REGISTRY_USERNAME != '' &&\n env.REGISTRY_PASSWORD != ''\n }}\" >> $GITHUB_OUTPUT\n" + run: | + env_vars=("CUSTOMER" "USERNAME" "PASSWORD" "CLIENT_ID" "SECRET_KEY" "REGISTRY_USERNAME" "REGISTRY_PASSWORD") + + for var_name in "${env_vars[@]}"; do + var_value="${!var_name}" + if [[ -z "${var_value// /}" ]]; then + echo "Environment variable '$var_name' is empty, null, or contains only whitespace. Failing the workflow." + exit 1 + fi + done + + echo "All environment variables are valid. Proceeding with the workflow." - id: export_tests_to_env name: set test name From f009e809b1a231849493e3323fc5f51259bb62b7 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Thu, 4 May 2023 10:40:29 +0300 Subject: [PATCH 03/44] updating permissions --- .github/workflows/package-release.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index ac1ae62..d1ac547 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -35,7 +35,7 @@ on: jobs: test: permissions: - pull-requests: write + pull-requests: write-all uses: ./.github/workflows/go-basic-tests.yaml with: GO_VERSION: ${{ inputs.GO_VERSION }} @@ -48,6 +48,8 @@ jobs: release: needs: test + permissions: + pull-requests: write-all env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b6d22fcf0ec617aa6e6ea94a822aa261f33bb3a3 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Thu, 4 May 2023 10:42:56 +0300 Subject: [PATCH 04/44] fix to write --- .github/workflows/package-release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index d1ac547..e228f5d 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -35,7 +35,7 @@ on: jobs: test: permissions: - pull-requests: write-all + pull-requests: write uses: ./.github/workflows/go-basic-tests.yaml with: GO_VERSION: ${{ inputs.GO_VERSION }} @@ -49,7 +49,7 @@ jobs: release: needs: test permissions: - pull-requests: write-all + pull-requests: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 959bb78f1a0a8f84552e1fd99aad84de43af6c24 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Thu, 4 May 2023 11:03:53 +0300 Subject: [PATCH 05/44] permissions update to release --- .github/workflows/package-release.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index e228f5d..4ed7454 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -58,6 +58,8 @@ jobs: - uses: actions/checkout@v3 - name: Create a release + permissions: + pull-requests: write id: create_release uses: actions/create-release@v1 with: From fa62741448bc098579142cbd0edee91b105cf3d6 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Mon, 8 May 2023 09:45:28 +0300 Subject: [PATCH 06/44] update permissions --- .github/workflows/package-release.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 4ed7454..c48b932 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -52,14 +52,10 @@ jobs: pull-requests: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Create a release - permissions: - pull-requests: write id: create_release uses: actions/create-release@v1 with: From 7af523f581be32bd873e54522bcd5e00e39dc378 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Mon, 8 May 2023 10:41:04 +0300 Subject: [PATCH 07/44] updating id-token --- .github/workflows/package-release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index c48b932..bca3e95 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -49,6 +49,7 @@ jobs: release: needs: test permissions: + id-token: write # This is required for requesting the JWT pull-requests: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 998f6ca1a51b148ecc2d02a1ff59cbfa9ffe41b4 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Mon, 8 May 2023 11:09:36 +0300 Subject: [PATCH 08/44] update release file --- .github/workflows/package-release.yaml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index bca3e95..9683249 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -1,5 +1,8 @@ name: Release on: + push: + tags: + - 'v*.*.*-rc.*' workflow_call: inputs: GO_VERSION: @@ -49,18 +52,19 @@ jobs: release: needs: test permissions: - id-token: write # This is required for requesting the JWT pull-requests: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Create a release - id: create_release - uses: actions/create-release@v1 - with: - release_name: "Release: ${{ inputs.RELEASE }}" - tag_name: ${{ inputs.RELEASE }} - draft: ${{ inputs.IS_DRAFT }} - prerelease: false + - name: Create Release + id: create_release + uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v1.0.${{ github.run_number }} + release_name: Release v1.0.${{ github.run_number }} + draft: false + prerelease: false \ No newline at end of file From b8198ae10fd6060055217ee23b7aa07aad44bfd4 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Mon, 8 May 2023 11:10:27 +0300 Subject: [PATCH 09/44] remove tags --- .github/workflows/package-release.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 9683249..75ea725 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -1,8 +1,5 @@ name: Release on: - push: - tags: - - 'v*.*.*-rc.*' workflow_call: inputs: GO_VERSION: From 68bac55f4df16161f7bb375822d67317250e366b Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Mon, 8 May 2023 11:12:44 +0300 Subject: [PATCH 10/44] fixing steps --- .github/workflows/package-release.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 75ea725..78d5da8 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -55,13 +55,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Create Release - id: create_release - uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: v1.0.${{ github.run_number }} - release_name: Release v1.0.${{ github.run_number }} - draft: false - prerelease: false \ No newline at end of file + name: Create Release + id: create_release + uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v1.0.${{ github.run_number }} + release_name: Release v1.0.${{ github.run_number }} + draft: false + prerelease: false \ No newline at end of file From c2d73ae6f677b96e42db057dfcb9e7211b19cddd Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Mon, 8 May 2023 11:16:12 +0300 Subject: [PATCH 11/44] fix --- .github/workflows/package-release.yaml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 78d5da8..58dbe36 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -54,14 +54,13 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - name: Create Release - id: create_release - uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: v1.0.${{ github.run_number }} - release_name: Release v1.0.${{ github.run_number }} - draft: false - prerelease: false \ No newline at end of file + - uses: actions/checkout@v3 + - name: Create Release + uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v1.0.${{ github.run_number }} + release_name: Release v1.0.${{ github.run_number }} + draft: false + prerelease: false \ No newline at end of file From 12f32d0adceac7887463efe16d2847a03f81b83d Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Mon, 8 May 2023 14:34:40 +0300 Subject: [PATCH 12/44] permissions fix #1 --- .github/workflows/package-release.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 58dbe36..772cd39 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -31,11 +31,11 @@ on: # required: false # type: boolean # default: true - +permissions: write-all jobs: test: - permissions: - pull-requests: write + # permissions: + # pull-requests: write uses: ./.github/workflows/go-basic-tests.yaml with: GO_VERSION: ${{ inputs.GO_VERSION }} @@ -48,8 +48,8 @@ jobs: release: needs: test - permissions: - pull-requests: write + # permissions: + # pull-requests: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest From 0f99d8ae5d1c08163ca4e5bc37265e35bc7d9d5b Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Mon, 8 May 2023 14:48:45 +0300 Subject: [PATCH 13/44] modified: .github/workflows/package-release.yaml --- .github/workflows/package-release.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 772cd39..f91c3ef 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -63,4 +63,5 @@ jobs: tag_name: v1.0.${{ github.run_number }} release_name: Release v1.0.${{ github.run_number }} draft: false - prerelease: false \ No newline at end of file + prerelease: false + permissions: write_repository, read_repository \ No newline at end of file From 0fbc4780e9986a9a5c79646098fe8c0efd49c525 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Mon, 8 May 2023 14:56:09 +0300 Subject: [PATCH 14/44] addign actions --- .github/workflows/package-release.yaml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index f91c3ef..1a36cde 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -48,8 +48,9 @@ jobs: release: needs: test - # permissions: - # pull-requests: write + permissions: + pull-requests: write + actions: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest @@ -57,11 +58,8 @@ jobs: - uses: actions/checkout@v3 - name: Create Release uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: v1.0.${{ github.run_number }} release_name: Release v1.0.${{ github.run_number }} draft: false - prerelease: false - permissions: write_repository, read_repository \ No newline at end of file + prerelease: false \ No newline at end of file From 1d3319b595bec3163d78d8a07dbdce8dbc2d688d Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Mon, 8 May 2023 14:56:57 +0300 Subject: [PATCH 15/44] removing write-all --- .github/workflows/package-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 1a36cde..48f9d6d 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -31,7 +31,7 @@ on: # required: false # type: boolean # default: true -permissions: write-all + jobs: test: # permissions: From ef3a7956f0445ee94e6d20da16a0425fadc91d06 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Mon, 8 May 2023 15:00:11 +0300 Subject: [PATCH 16/44] fix --- .github/workflows/package-release.yaml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 48f9d6d..4a4bbe9 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -34,8 +34,8 @@ on: jobs: test: - # permissions: - # pull-requests: write + permissions: + pull-requests: write uses: ./.github/workflows/go-basic-tests.yaml with: GO_VERSION: ${{ inputs.GO_VERSION }} @@ -48,9 +48,9 @@ jobs: release: needs: test - permissions: - pull-requests: write - actions: write + # permissions: + # pull-requests: write + # actions: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest @@ -58,8 +58,11 @@ jobs: - uses: actions/checkout@v3 - name: Create Release uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: v1.0.${{ github.run_number }} release_name: Release v1.0.${{ github.run_number }} draft: false - prerelease: false \ No newline at end of file + prerelease: false + secrets: inherit From 46fb973417833a53f117f5c9ef0216b4c65e6060 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Mon, 8 May 2023 15:06:18 +0300 Subject: [PATCH 17/44] fix --- .github/workflows/package-release.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 4a4bbe9..ba4ad20 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -48,9 +48,8 @@ jobs: release: needs: test - # permissions: - # pull-requests: write - # actions: write + permissions: + pull-requests: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest @@ -65,4 +64,3 @@ jobs: release_name: Release v1.0.${{ github.run_number }} draft: false prerelease: false - secrets: inherit From 98110e7d90ee89f0cabfe184c67b09eba2ece03c Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Mon, 8 May 2023 15:15:39 +0300 Subject: [PATCH 18/44] updates --- .github/workflows/go-basic-tests.yaml | 2 +- .github/workflows/pr.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go-basic-tests.yaml b/.github/workflows/go-basic-tests.yaml index 0dd95cb..2eef3d1 100644 --- a/.github/workflows/go-basic-tests.yaml +++ b/.github/workflows/go-basic-tests.yaml @@ -118,7 +118,7 @@ jobs: runs-on: ubuntu-latest needs: [Check-secret, Environment-Test] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-go@v3 name: Setup Go diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 324ad2d..f18ec82 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -35,9 +35,9 @@ jobs: pull-requests: write uses: ./.github/workflows/package-release.yaml with: - RELEASE: "v0.0.${{ github.run_number }}" + # RELEASE: "v0.0.${{ github.run_number }}" GO_VERSION: 1.19 - IS_DRAFT: true + # IS_DRAFT: true BUILD_PATH: "./testdata/." UNIT_TESTS_PATH: "./testdata/." secrets: inherit From d67cb5e7edd1e9e4ae3f2988d84d9aad3fac5bb7 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Mon, 8 May 2023 15:17:09 +0300 Subject: [PATCH 19/44] fix --- .github/workflows/pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index f18ec82..ff04be7 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -35,9 +35,9 @@ jobs: pull-requests: write uses: ./.github/workflows/package-release.yaml with: - # RELEASE: "v0.0.${{ github.run_number }}" + RELEASE: "v1.0.${{ github.run_number }}" GO_VERSION: 1.19 - # IS_DRAFT: true + IS_DRAFT: false BUILD_PATH: "./testdata/." UNIT_TESTS_PATH: "./testdata/." secrets: inherit From 15fb8787e152fef3d692bf38b79d78b186993244 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Mon, 8 May 2023 15:25:54 +0300 Subject: [PATCH 20/44] add write --- .github/workflows/package-release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index ba4ad20..6e2cf9c 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -50,6 +50,7 @@ jobs: needs: test permissions: pull-requests: write + actions: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest From 9a137b77e5b9b507ce35ec76d193fbc84fb28c5d Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Mon, 8 May 2023 15:59:43 +0300 Subject: [PATCH 21/44] modified: .github/workflows/package-release.yaml --- .github/workflows/package-release.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 6e2cf9c..ba2b19c 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -49,7 +49,6 @@ jobs: release: needs: test permissions: - pull-requests: write actions: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 530beb00178ac791b6172aa983df6d63990bbd92 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Mon, 8 May 2023 16:01:38 +0300 Subject: [PATCH 22/44] retrieve --- .github/workflows/package-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index ba2b19c..ba4ad20 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -49,7 +49,7 @@ jobs: release: needs: test permissions: - actions: write + pull-requests: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest From 29fbc8db643e24dd2b4fb2988f18b71c546fb730 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 10:06:13 +0300 Subject: [PATCH 23/44] remove env --- .github/workflows/package-release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index ba4ad20..f020cd8 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -57,8 +57,8 @@ jobs: - uses: actions/checkout@v3 - name: Create Release uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: v1.0.${{ github.run_number }} release_name: Release v1.0.${{ github.run_number }} From a03406f35d6836a3ad598901a2b19ca5fe23c39a Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 10:19:35 +0300 Subject: [PATCH 24/44] adding issues --- .github/workflows/package-release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index f020cd8..f74c7bf 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -49,6 +49,7 @@ jobs: release: needs: test permissions: + issues: write pull-requests: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 0c55e9873875770faef53902d2c4d298bf696225 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 10:20:22 +0300 Subject: [PATCH 25/44] json format test --- .github/workflows/package-release.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index f74c7bf..831b8c0 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -48,9 +48,10 @@ jobs: release: needs: test - permissions: + permissions: { issues: write pull-requests: write + } env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest From 5ded91581c7bd2ee1e34db05bfe3e01421dec271 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 10:20:29 +0300 Subject: [PATCH 26/44] fix --- .github/workflows/package-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 831b8c0..8ba13c0 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -49,7 +49,7 @@ jobs: release: needs: test permissions: { - issues: write + issues: write, pull-requests: write } env: From 78d1a6e6c7ede506dbf93a50be9dd12786e283d5 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 10:21:44 +0300 Subject: [PATCH 27/44] remove permissions --- .github/workflows/package-release.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 8ba13c0..fe30235 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -34,8 +34,6 @@ on: jobs: test: - permissions: - pull-requests: write uses: ./.github/workflows/go-basic-tests.yaml with: GO_VERSION: ${{ inputs.GO_VERSION }} @@ -48,10 +46,6 @@ jobs: release: needs: test - permissions: { - issues: write, - pull-requests: write - } env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest From a747ad302158220043090599a035b3ef8b6cbbdf Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 10:24:55 +0300 Subject: [PATCH 28/44] test with contents permissions --- .github/workflows/package-release.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index fe30235..f250291 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -34,6 +34,8 @@ on: jobs: test: + permissions: + pull-requests: write uses: ./.github/workflows/go-basic-tests.yaml with: GO_VERSION: ${{ inputs.GO_VERSION }} @@ -46,6 +48,8 @@ jobs: release: needs: test + permissions: + contents: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest From 65dc0945f74d88eb5c7e497f0b9808b22f1e2349 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 10:29:20 +0300 Subject: [PATCH 29/44] updates --- .github/workflows/package-release.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index f250291..9e2897c 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -57,8 +57,6 @@ jobs: - uses: actions/checkout@v3 - name: Create Release uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: v1.0.${{ github.run_number }} release_name: Release v1.0.${{ github.run_number }} From 520b22acdcb7eb9da7ff46755447f5a7a8627463 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 10:31:03 +0300 Subject: [PATCH 30/44] modified: .github/workflows/package-release.yaml --- .github/workflows/package-release.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 9e2897c..2810461 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -34,8 +34,6 @@ on: jobs: test: - permissions: - pull-requests: write uses: ./.github/workflows/go-basic-tests.yaml with: GO_VERSION: ${{ inputs.GO_VERSION }} From 4f7128aae784fc0ca959f01c6738831c1e434a43 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 10:57:52 +0300 Subject: [PATCH 31/44] per, upodate --- .github/workflows/package-release.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 2810461..eee1d2f 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -46,8 +46,17 @@ jobs: release: needs: test - permissions: + permissions: + actions: none + checks: none contents: write + deployments: none + issues: none + packages: none + pull-requests: write + repository-projects: none + security-events: none + statuses: none env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest From 182adf74e2208bb776882e19db4cb24b04884d61 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 11:06:32 +0300 Subject: [PATCH 32/44] none submit --- .github/workflows/package-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index eee1d2f..7bdad2a 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -49,7 +49,7 @@ jobs: permissions: actions: none checks: none - contents: write + contents: none deployments: none issues: none packages: none From 9f27eff4bd337bd540ffbd933afbeb8e2551d44d Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 11:23:20 +0300 Subject: [PATCH 33/44] modified: .github/workflows/package-release.yaml --- .github/workflows/package-release.yaml | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 7bdad2a..a7d3a80 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -47,25 +47,19 @@ jobs: release: needs: test permissions: - actions: none - checks: none - contents: none - deployments: none - issues: none - packages: none pull-requests: write - repository-projects: none - security-events: none - statuses: none env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Create Release - uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e + # uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e + uses: pipe-cd/actions-gh-release@v2.3.4 with: - tag_name: v1.0.${{ github.run_number }} - release_name: Release v1.0.${{ github.run_number }} - draft: false - prerelease: false + release_file: '**/RELEASE' + token: ${{ secrets.GITHUB_TOKEN }} + # tag_name: v1.0.${{ github.run_number }} + # release_name: Release v1.0.${{ github.run_number }} + # draft: false + # prerelease: false \ No newline at end of file From 2de27c44e274f37f6e6fa2ad0c1691dadf3ea8b4 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 12:24:34 +0300 Subject: [PATCH 34/44] modified: .github/workflows/package-release.yaml --- .github/workflows/package-release.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index a7d3a80..a0780e0 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -31,6 +31,8 @@ on: # required: false # type: boolean # default: true + paths: + - '**/RELEASE' jobs: test: From 6b38e5214f584c5548d516e456c98b568c596d4e Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 13:14:32 +0300 Subject: [PATCH 35/44] modified: .github/workflows/package-release.yaml --- .github/workflows/package-release.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index a0780e0..51789d6 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -50,8 +50,8 @@ jobs: needs: test permissions: pull-requests: write - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -59,7 +59,7 @@ jobs: # uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e uses: pipe-cd/actions-gh-release@v2.3.4 with: - release_file: '**/RELEASE' + # release_file: '**/RELEASE' token: ${{ secrets.GITHUB_TOKEN }} # tag_name: v1.0.${{ github.run_number }} # release_name: Release v1.0.${{ github.run_number }} From ec41e164a4018a428c78289f4539ef8255d6da6c Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 13:15:21 +0300 Subject: [PATCH 36/44] modified: .github/workflows/package-release.yaml --- .github/workflows/package-release.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 51789d6..293c317 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -31,8 +31,6 @@ on: # required: false # type: boolean # default: true - paths: - - '**/RELEASE' jobs: test: From 95678cd352b497515ee608429abf6ee73a38356e Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 13:47:10 +0300 Subject: [PATCH 37/44] modified: .github/workflows/package-release.yaml modified: .github/workflows/pr.yaml --- .github/workflows/package-release.yaml | 22 +++++++++++----------- .github/workflows/pr.yaml | 1 + 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 293c317..748aed3 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -46,20 +46,20 @@ jobs: release: needs: test - permissions: - pull-requests: write - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # permissions: + # pull-requests: write + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Create Release - # uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e - uses: pipe-cd/actions-gh-release@v2.3.4 + uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e + # uses: pipe-cd/actions-gh-release@v2.3.4 with: # release_file: '**/RELEASE' - token: ${{ secrets.GITHUB_TOKEN }} - # tag_name: v1.0.${{ github.run_number }} - # release_name: Release v1.0.${{ github.run_number }} - # draft: false - # prerelease: false \ No newline at end of file + # token: ${{ secrets.GITHUB_TOKEN }} + tag_name: v1.0.${{ github.run_number }} + release_name: Release v1.0.${{ github.run_number }} + draft: false + prerelease: false \ No newline at end of file diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index ff04be7..8c316b3 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -32,6 +32,7 @@ jobs: validate-package-releaser-file: needs: validate-go-basic-tests-file permissions: + contents: write pull-requests: write uses: ./.github/workflows/package-release.yaml with: From 123a6693f1d86184617bb1cde357b125f8a0de81 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 14:07:33 +0300 Subject: [PATCH 38/44] modified: .github/workflows/package-release.yaml modified: .github/workflows/pr.yaml --- .github/workflows/package-release.yaml | 9 ++------- .github/workflows/pr.yaml | 14 ++------------ 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 748aed3..ee72798 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -46,8 +46,6 @@ jobs: release: needs: test - # permissions: - # pull-requests: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest @@ -55,11 +53,8 @@ jobs: - uses: actions/checkout@v3 - name: Create Release uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e - # uses: pipe-cd/actions-gh-release@v2.3.4 with: - # release_file: '**/RELEASE' - # token: ${{ secrets.GITHUB_TOKEN }} - tag_name: v1.0.${{ github.run_number }} - release_name: Release v1.0.${{ github.run_number }} + tag_name: v*.*.${{ github.run_number }} + release_name: Release v*.*.${{ github.run_number }} draft: false prerelease: false \ No newline at end of file diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 8c316b3..3ce4087 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -18,17 +18,7 @@ jobs: # TEST_MULTI_ENVIRONMENTS: true secrets: inherit - # validate-go-basic-tests-file-single-os: - # permissions: - # pull-requests: write - # uses: ./.github/workflows/go-basic-tests.yaml - # with: - # GO_VERSION: 1.19 - # BUILD_PATH: "./testdata/." - # UNIT_TESTS_PATH: "./testdata/." - # TEST_MULTI_ENVIRONMENTS: false - # secrets: inherit - + # Validate release files and release pkg. validate-package-releaser-file: needs: validate-go-basic-tests-file permissions: @@ -36,7 +26,7 @@ jobs: pull-requests: write uses: ./.github/workflows/package-release.yaml with: - RELEASE: "v1.0.${{ github.run_number }}" + RELEASE: "v*.*.${{ github.run_number }}" GO_VERSION: 1.19 IS_DRAFT: false BUILD_PATH: "./testdata/." From 48b0c88def1984f635c1d161476bdc9f44d10fdf Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 15:20:14 +0300 Subject: [PATCH 39/44] updating release tag --- .github/workflows/package-release.yaml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index ee72798..cfe9a11 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -31,7 +31,9 @@ on: # required: false # type: boolean # default: true - + push: + tags: + - 'v*.*.*-rc.*' jobs: test: uses: ./.github/workflows/go-basic-tests.yaml @@ -46,15 +48,22 @@ jobs: release: needs: test + outputs: + NEW_TAG: ${{ steps.tag-calculator.outputs.NEW_TAG }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest steps: + - id: tag-calculator + uses: kubescape/workflows/.github/actions/tag-action@main + with: + ORIGINAL_TAG: ${{ inputs.TAG }} + SUB_STRING: "-rc" - uses: actions/checkout@v3 - name: Create Release uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e with: - tag_name: v*.*.${{ github.run_number }} - release_name: Release v*.*.${{ github.run_number }} + tag_name: ${{ steps.tag-calculator.outputs.NEW_TAG }} + release_name: Release ${{ steps.tag-calculator.outputs.NEW_TAG }} draft: false prerelease: false \ No newline at end of file From 273ef5aec5344f448c115c28fc7c1424b317d7ac Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 15:49:00 +0300 Subject: [PATCH 40/44] fixing --- .github/workflows/package-release.yaml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index cfe9a11..fd492ce 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -31,9 +31,10 @@ on: # required: false # type: boolean # default: true - push: - tags: - - 'v*.*.*-rc.*' + # push: + # tags: + # - 'v*.*.*-rc.*' + jobs: test: uses: ./.github/workflows/go-basic-tests.yaml @@ -48,22 +49,22 @@ jobs: release: needs: test - outputs: - NEW_TAG: ${{ steps.tag-calculator.outputs.NEW_TAG }} + # outputs: + # NEW_TAG: ${{ steps.tag-calculator.outputs.NEW_TAG }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest steps: - - id: tag-calculator - uses: kubescape/workflows/.github/actions/tag-action@main - with: - ORIGINAL_TAG: ${{ inputs.TAG }} - SUB_STRING: "-rc" + # - id: tag-calculator + # uses: kubescape/workflows/.github/actions/tag-action@main + # with: + # ORIGINAL_TAG: ${{ inputs.TAG }} + # SUB_STRING: "-rc" - uses: actions/checkout@v3 - name: Create Release uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e with: - tag_name: ${{ steps.tag-calculator.outputs.NEW_TAG }} - release_name: Release ${{ steps.tag-calculator.outputs.NEW_TAG }} + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} draft: false prerelease: false \ No newline at end of file From e8637d7212bef29ca09fe65bd9b7504f8407b171 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Tue, 9 May 2023 15:50:36 +0300 Subject: [PATCH 41/44] modified: .github/workflows/pr.yaml --- .github/workflows/pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 3ce4087..c1007ef 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -26,7 +26,7 @@ jobs: pull-requests: write uses: ./.github/workflows/package-release.yaml with: - RELEASE: "v*.*.${{ github.run_number }}" + RELEASE: "${{ github.ref }}" GO_VERSION: 1.19 IS_DRAFT: false BUILD_PATH: "./testdata/." From 8d625a6cc544d607f826eed7ac3283f2986aa074 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Thu, 11 May 2023 08:32:45 +0300 Subject: [PATCH 42/44] adding create_release process --- .github/workflows/package-release.yaml | 61 ++++++++++++++++++-------- 1 file changed, 43 insertions(+), 18 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index fd492ce..87cabff 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -31,9 +31,9 @@ on: # required: false # type: boolean # default: true - # push: - # tags: - # - 'v*.*.*-rc.*' + push: + tags: + - 'v*.*.*' jobs: test: @@ -47,24 +47,49 @@ jobs: # TEST_MULTI_ENVIRONMENTS: ${{ inputs.TEST_MULTI_ENVIRONMENTS }} secrets: inherit - release: - needs: test - # outputs: - # NEW_TAG: ${{ steps.tag-calculator.outputs.NEW_TAG }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # release: + # needs: test + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v3 + # - name: Create Release + # uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e + # with: + # tag_name: ${{ steps.tag-calculator.outputs.NEW_TAG }} + # release_name: Release ${{ steps.tag-calculator.outputs.NEW_TAG }} + # draft: false + # prerelease: false + + create_release: runs-on: ubuntu-latest steps: - # - id: tag-calculator - # uses: kubescape/workflows/.github/actions/tag-action@main - # with: - # ORIGINAL_TAG: ${{ inputs.TAG }} - # SUB_STRING: "-rc" - - uses: actions/checkout@v3 - - name: Create Release - uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '14.x' + + - name: Install dependencies + run: npm install + + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} release_name: Release ${{ github.ref }} + body: | + Changes: + - First change + - Second change draft: false - prerelease: false \ No newline at end of file + prerelease: false + + - name: Get the release ID + run: echo "Release ID - ${{ steps.create_release.outputs.id }}" \ No newline at end of file From ac105ecf8d6ce0bec65ea33fe06949809ea0ea94 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Thu, 11 May 2023 08:49:52 +0300 Subject: [PATCH 43/44] modified: .github/workflows/package-release.yaml --- .github/workflows/package-release.yaml | 44 ++++++++++++++++++-------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 87cabff..4fff009 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -33,7 +33,7 @@ on: # default: true push: tags: - - 'v*.*.*' + - '*' jobs: test: @@ -66,15 +66,34 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v2 + uses: actions/checkout@v2 with: - node-version: '14.x' + fetch-depth: 0 + + - name: Get latest tag + id: get_latest_tag + run: | + latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1)) + echo "Latest tag: $latest_tag" + + - name: Extract version + id: extract_version + run: | + version=$(echo $latest_tag | jq -r 'sub("^[^0-9]*"; "")') + echo "Version: $version" - - name: Install dependencies - run: npm install + - name: Increase version + id: increase_version + run: | + next_version=$((version + 1)) + echo "Next version: $next_version" + + - name: Set tag name + id: set_tag_name + run: | + tag_name=v$next_version + echo "::set-output name=tag_name::$tag_name" + continue-on-error: true - name: Create release id: create_release @@ -82,14 +101,11 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} + tag_name: ${{ steps.set_tag_name.outputs.tag_name }} + release_name: Release ${{ steps.set_tag_name.outputs.tag_name }} body: | Changes: - First change - Second change draft: false - prerelease: false - - - name: Get the release ID - run: echo "Release ID - ${{ steps.create_release.outputs.id }}" \ No newline at end of file + prerelease: false \ No newline at end of file From d52a9cb0c13af48cc543e49a3a730f7789078299 Mon Sep 17 00:00:00 2001 From: Yuval Leibovich Date: Thu, 11 May 2023 09:05:05 +0300 Subject: [PATCH 44/44] modified: .github/workflows/package-release.yaml --- .github/workflows/package-release.yaml | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 4fff009..5bf08b0 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -33,7 +33,7 @@ on: # default: true push: tags: - - '*' + - 'v*.*.*' jobs: test: @@ -47,26 +47,12 @@ jobs: # TEST_MULTI_ENVIRONMENTS: ${{ inputs.TEST_MULTI_ENVIRONMENTS }} secrets: inherit - # release: - # needs: test - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - name: Create Release - # uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e - # with: - # tag_name: ${{ steps.tag-calculator.outputs.NEW_TAG }} - # release_name: Release ${{ steps.tag-calculator.outputs.NEW_TAG }} - # draft: false - # prerelease: false - create_release: + needs: test runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 @@ -87,11 +73,12 @@ jobs: run: | next_version=$((version + 1)) echo "Next version: $next_version" - + - name: Set tag name id: set_tag_name run: | - tag_name=v$next_version + next_version=$((${{ github.event_name == 'release' }} ? $(echo "${{ github.ref }}" | awk -F'/' '{print $3}') : $(echo "${{ github.ref }}-$(date +%s)" | awk -F'/' '{print $3}'))) + tag_name=v$(echo "$next_version" | cut -d'.' -f-3) echo "::set-output name=tag_name::$tag_name" continue-on-error: true