From 14fff35dbabcac650971ad78b48f3cbbc035d28b Mon Sep 17 00:00:00 2001 From: jerensl <54782057+jerensl@users.noreply.github.com> Date: Thu, 7 Nov 2024 16:35:47 +0800 Subject: [PATCH 1/3] ci: wait for npm release and trigger the upgrade Signed-off-by: jerensl <54782057+jerensl@users.noreply.github.com> --- .github/workflows/bump-meshery-version.yml | 23 ++++++++++++++++--- .github/workflows/release.yml | 26 ++++++++++++++++++++++ 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bump-meshery-version.yml b/.github/workflows/bump-meshery-version.yml index ab48cd36..8aeb890c 100644 --- a/.github/workflows/bump-meshery-version.yml +++ b/.github/workflows/bump-meshery-version.yml @@ -1,10 +1,27 @@ name: Bump Meshery, Meshery Extensions and Meshery Cloud on: - release: - types: [published] + workflow_run: + workflows: [Publish Node.js Package] + types: + - completed jobs: + versions-check: + runs-on: ubuntu-latest + outputs: + current: ${{ steps.current.outputs.VERSION }} + steps: + - name: Download Version + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: e2e-test-reporter + github-token: ${{ secrets.GH_ACCESS_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Retrieve Version + run: | + echo "VERSION=$(cat ./version/number)" >> $GITHUB_OUTPUT + id: current bump-meshery: runs-on: ubuntu-latest steps: @@ -21,7 +38,7 @@ jobs: cache-dependency-path: '**/package-lock.json' - name: Make changes to pull request working-directory: ui - run: npm install @layer5/sistent@latest + run: npm install @layer5/sistent@${{job.status}} - name: Create Pull Request id: cpr uses: peter-evans/create-pull-request@v7 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c54a481a..51cfae3c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,3 +44,29 @@ jobs: npm publish --verbose env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + versions-check: + runs-on: ubuntu-latest + outputs: + current: ${{ steps.versions.outputs }} + steps: + - uses: actions/github-script@v7 + id: versions + with: + result-encoding: string + script: | + let str = "${{github.event.release.tag_name}}" + + return str.replace(/^v/, '') + - name: Save Release number + if: ${{ !cancelled() }} + run: | + mkdir -p ./version + echo ${{ steps.versions.outputs }} > ./version/number + - name: Upload Version Report + if: ${{ !cancelled() }} + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + with: + name: version-number + path: | + version/number + retention-days: 14 \ No newline at end of file From 936aaac428ad75a98144684f11897ed86755efe2 Mon Sep 17 00:00:00 2001 From: jerensl <54782057+jerensl@users.noreply.github.com> Date: Thu, 7 Nov 2024 16:41:21 +0800 Subject: [PATCH 2/3] ci: change the event using version from artifact Signed-off-by: jerensl <54782057+jerensl@users.noreply.github.com> --- .github/workflows/bump-meshery-version.yml | 27 ++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/bump-meshery-version.yml b/.github/workflows/bump-meshery-version.yml index 8aeb890c..bfd24c16 100644 --- a/.github/workflows/bump-meshery-version.yml +++ b/.github/workflows/bump-meshery-version.yml @@ -24,6 +24,7 @@ jobs: id: current bump-meshery: runs-on: ubuntu-latest + needs: versions-check steps: - name: Checkout Meshery code uses: actions/checkout@v4 @@ -38,30 +39,31 @@ jobs: cache-dependency-path: '**/package-lock.json' - name: Make changes to pull request working-directory: ui - run: npm install @layer5/sistent@${{job.status}} + run: npm install @layer5/sistent@${{needs.versions-check.outputs.current}} - name: Create Pull Request id: cpr uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.RELEASEDRAFTER_PAT }} - commit-message: Bump sistent ${{ github.event.release.tag_name }} dependencies + commit-message: Bump sistent v${{ needs.versions-check.outputs.current }} dependencies committer: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> signoff: true branch: bump-sistent-bot delete-branch: true - title: '[Chore]: Bump ${{ github.event.release.name }}' + title: '[Chore]: Bump v${{ needs.versions-check.outputs.current }}' add-paths: | ui/package.json ui/package-lock.json body: | - Update to Sistent ${{ github.event.release.tag_name }} + Update to Sistent v${{ needs.versions-check.outputs.current }} _This pull request has been auto-generated by [l5io](http://github.com/l5io)_ assignees: l5io draft: false bump-meshery-extensions: runs-on: ubuntu-latest + needs: versions-check steps: - name: Checkout Meshery Extensions code uses: actions/checkout@v4 @@ -76,30 +78,31 @@ jobs: cache-dependency-path: '**/package-lock.json' - name: Make changes to pull request working-directory: meshmap - run: npm install @layer5/sistent@latest + run: npm install @layer5/sistent@${{needs.versions-check.outputs.current}} - name: Create Pull Request id: cpr uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.RELEASEDRAFTER_PAT }} - commit-message: Bump sistent ${{ github.event.release.tag_name }} dependencies + commit-message: Bump sistent v${{ needs.versions-check.outputs.current }} dependencies committer: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> signoff: true branch: bump-sistent-bot delete-branch: true - title: '[Chore]: Bump ${{ github.event.release.name }}' + title: '[Chore]: Bump v${{needs.versions-check.outputs.current }}' add-paths: | meshmap/package.json meshmap/package-lock.json body: | - Update to Sistent ${{ github.event.release.tag_name }} + Update to Sistent v${{ needs.versions-check.outputs.current }} _This pull request has been auto-generated by [l5io](http://github.com/l5io)_ assignees: l5io draft: false bump-meshery-cloud: runs-on: ubuntu-latest + needs: versions-check steps: - name: Checkout Meshery Extensions code uses: actions/checkout@v4 @@ -114,24 +117,24 @@ jobs: cache-dependency-path: '**/package-lock.json' - name: Make changes to pull request working-directory: ui - run: npm install @layer5/sistent@latest + run: npm install @layer5/sistent@${{needs.versions-check.outputs.current}} - name: Create Pull Request id: cpr uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.RELEASEDRAFTER_PAT }} - commit-message: Bump sistent ${{ github.event.release.tag_name }} dependencies + commit-message: Bump sistent v${{ needs.versions-check.outputs.current }} dependencies committer: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> signoff: true branch: bump-sistent-bot delete-branch: true - title: '[Chore]: Bump ${{ github.event.release.name }}' + title: '[Chore]: Bump v${{ needs.versions-check.outputs.current }}' add-paths: | ui/package.json ui/package-lock.json body: | - Update to Sistent ${{ github.event.release.tag_name }} + Update to Sistent v${{ needs.versions-check.outputs.current }} _This pull request has been auto-generated by [l5io](http://github.com/l5io)_ assignees: l5io From 41f323d85600bd03c4d5c200f4f706b0423f08a9 Mon Sep 17 00:00:00 2001 From: jerensl <54782057+jerensl@users.noreply.github.com> Date: Thu, 7 Nov 2024 18:11:09 +0800 Subject: [PATCH 3/3] ci: make version check wait until npm publish Signed-off-by: jerensl <54782057+jerensl@users.noreply.github.com> --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 51cfae3c..31260f5c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,6 +45,7 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} versions-check: + needs: publish-gpr runs-on: ubuntu-latest outputs: current: ${{ steps.versions.outputs }}