From 38a70e21aef870f15e774f28e0b2740587106d46 Mon Sep 17 00:00:00 2001 From: Enguerrand Allamel Date: Tue, 27 Aug 2024 15:39:26 +0200 Subject: [PATCH] fix(minor-major): add major or minor tag update --- .github/workflows/release.yaml | 48 ++++++++++++++++++++++++++++---- actions/jfrog-upload/action.yaml | 2 +- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9087117..c7aaf5f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -45,7 +45,7 @@ jobs: fail-fast: false matrix: ${{fromJson(needs.changelist.outputs.changed_actions)}} steps: - - name: get ghapp-cybersecurity-ci token + - name: "[CI] Get Github Token based on Github App authentication" id: ghapp-cybersecurity-ci uses: getsentry/action-github-app-token@v3 with: @@ -60,10 +60,46 @@ jobs: monorepo-tags: true path: ${{ matrix.component }} include-v-in-tag: false - - uses: actions/checkout@v4 + - name: "[Release] Checkout code" + if: ${{ steps.release.outputs.release_created }} + uses: actions/checkout@v4 with: fetch-depth: 100 - - name: tag major and minor versions - if: ${{ steps.release.outputs.releases_created }} - run: | - echo ${{ steps.release.outputs }} \ No newline at end of file + - name: "[Release] Update Major tags" + uses: actions/github-script@v7 + with: + github-token: ${{ steps.ghapp-cybersecurity-ci.outputs.token }} + script: | + // Major + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'refs/tags/v${{ steps.release.outputs.major }}', + sha: context.sha + }).catch(err => { + if (err.status !== 422) throw err; + github.rest.git.updateRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'tags/v${{ steps.release.outputs.major }}', + sha: context.sha + }); + }) + // Minor + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'refs/tags/v${{ steps.release.outputs.minor }}', + sha: context.sha + }).catch(err => { + if (err.status !== 422) throw err; + github.rest.git.updateRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'tags/v${{ steps.release.outputs.minor }}', + sha: context.sha + }); + }) + + + diff --git a/actions/jfrog-upload/action.yaml b/actions/jfrog-upload/action.yaml index f9def2e..25c74c4 100644 --- a/actions/jfrog-upload/action.yaml +++ b/actions/jfrog-upload/action.yaml @@ -19,7 +19,7 @@ runs: JF_URL: "https://artifactory.ledgerlabs.net" with: oidc-provider-name: github - oidc-audience: artifactory-2 + oidc-audience: artifactory-3 - run: | jfrog rt u ${{ inputs.path }} ${{ inputs.artifactory_repository}} shell: bash \ No newline at end of file