From f63dafdf831d163c17674dc2c17eef8a35f7fee2 Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Tue, 9 Jul 2024 12:45:47 +0500 Subject: [PATCH 01/23] perf: added workflow to preview expected version on PR --- .github/workflows/release-version.yml | 102 ++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 .github/workflows/release-version.yml diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml new file mode 100644 index 00000000..7c8581ba --- /dev/null +++ b/.github/workflows/release-version.yml @@ -0,0 +1,102 @@ +name: Next Release Version +on: + pull_request: + branches: + - "master" + +jobs: + release-type: + name: Check Release Type + runs-on: ubuntu-latest + outputs: + release_level: ${{ steps.release_type.outputs.RELEASE_TYPE }} + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: ${{ env.GITHUB_SHA }} + - name: Get Commit Messages + id: get_commit_messages + run: | + PR_NUMBER=${{ github.event.pull_request.number }} + COMMITS=$(curl -s -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER/commits") + COMBINED_MESSAGES=$(echo "$COMMITS" | jq -r '.[].commit.message' | paste -sd ' ') + echo "COMBINED_MESSAGES=$COMBINED_MESSAGES" >> $GITHUB_OUTPUT + - name: Get Release Type + id: release_type + run: | + if echo "${{ steps.get_commit_messages.outputs.COMBINED_MESSAGES }}" | grep -q "BREAKING CHANGE"; then + echo "RELEASE_TYPE=major" >> $GITHUB_OUTPUT + elif echo "${{ steps.get_commit_messages.outputs.COMBINED_MESSAGES }}" | grep -q "feat"; then + echo "RELEASE_TYPE=minor" >> $GITHUB_OUTPUT + elif echo "${{ steps.get_commit_messages.outputs.COMBINED_MESSAGES }}" | grep -q "fix"; then + echo "RELEASE_TYPE=patch" >> $GITHUB_OUTPUT + else + echo "RELEASE_TYPE=none" >> $GITHUB_OUTPUT + fi + determine-next-version: + name: Determine Next Version + needs: [release-type] + if: needs.release-type.outputs.release_level != 'none' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: ${{ env.GITHUB_SHA }} + - name: Get latest tag + uses: actions-ecosystem/action-get-latest-tag@v1 + id: get-latest-tag + - name: Determine Next Version + id: next_version + run: | + echo ${{ steps.get-latest-tag.outputs.tag }} + IFS='v' read -r -a VERSION <<< "${{ steps.get-latest-tag.outputs.tag }}" + IFS='.' read -r -a VERSION_PARTS <<< "${VERSION[1]}" + MAJOR=${VERSION_PARTS[0]} + MINOR=${VERSION_PARTS[1]} + PATCH=${VERSION_PARTS[2]} + + if [ "${{ needs.release-type.outputs.release_level }}" = "major" ]; then + MAJOR=$((MAJOR + 1)) + MINOR=$MINOR + PATCH=$PATCH + elif [ "${{ needs.release-type.outputs.release_level }}" = "minor" ]; then + MINOR=$((MINOR + 1)) + PATCH=$PATCH + elif [ "${{ needs.release-type.outputs.release_level }}" = "patch" ]; then + PATCH=$((PATCH + 1)) + fi + + NEXT_TAG="v$MAJOR.$MINOR.$PATCH" + echo "NEXT_TAG=$NEXT_TAG" >> $GITHUB_OUTPUT + - name: List PR comments + id: list-comments + run: | + PR_NUMBER=${{ github.event.pull_request.number }} + COMMENTS=$(curl -s -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/comments") + echo "$COMMENTS" > comments.json + + - name: Identify and delete previous comment + run: | + COMMENT_IDS=$(jq -r '.[] | select(.user.login=="github-actions[bot]") | .id' comments.json) + for COMMENT_ID in $COMMENT_IDS; do + echo "Deleting comment ID $COMMENT_ID" + curl -s -X DELETE -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/issues/comments/$COMMENT_ID" + done + - name: Script to comment on PR + uses: actions/github-script@v6 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '🎉 This PR is included in version ${{ steps.next_version.outputs.NEXT_TAG }} 🎉 ' + }) \ No newline at end of file From efc2d0680e2f57ec440abbded99c3ca68ef94505 Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Tue, 9 Jul 2024 14:06:36 +0500 Subject: [PATCH 02/23] perf: replace with general file --- .github/workflows/release-version.yml | 104 ++------------------------ 1 file changed, 7 insertions(+), 97 deletions(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 7c8581ba..742b8cf3 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -1,102 +1,12 @@ -name: Next Release Version +# comment the expected version on PR + +name: Comment Expected Release Version + on: pull_request: branches: - - "master" + - master jobs: - release-type: - name: Check Release Type - runs-on: ubuntu-latest - outputs: - release_level: ${{ steps.release_type.outputs.RELEASE_TYPE }} - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - ref: ${{ env.GITHUB_SHA }} - - name: Get Commit Messages - id: get_commit_messages - run: | - PR_NUMBER=${{ github.event.pull_request.number }} - COMMITS=$(curl -s -H "Accept: application/vnd.github.v3+json" \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER/commits") - COMBINED_MESSAGES=$(echo "$COMMITS" | jq -r '.[].commit.message' | paste -sd ' ') - echo "COMBINED_MESSAGES=$COMBINED_MESSAGES" >> $GITHUB_OUTPUT - - name: Get Release Type - id: release_type - run: | - if echo "${{ steps.get_commit_messages.outputs.COMBINED_MESSAGES }}" | grep -q "BREAKING CHANGE"; then - echo "RELEASE_TYPE=major" >> $GITHUB_OUTPUT - elif echo "${{ steps.get_commit_messages.outputs.COMBINED_MESSAGES }}" | grep -q "feat"; then - echo "RELEASE_TYPE=minor" >> $GITHUB_OUTPUT - elif echo "${{ steps.get_commit_messages.outputs.COMBINED_MESSAGES }}" | grep -q "fix"; then - echo "RELEASE_TYPE=patch" >> $GITHUB_OUTPUT - else - echo "RELEASE_TYPE=none" >> $GITHUB_OUTPUT - fi - determine-next-version: - name: Determine Next Version - needs: [release-type] - if: needs.release-type.outputs.release_level != 'none' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - ref: ${{ env.GITHUB_SHA }} - - name: Get latest tag - uses: actions-ecosystem/action-get-latest-tag@v1 - id: get-latest-tag - - name: Determine Next Version - id: next_version - run: | - echo ${{ steps.get-latest-tag.outputs.tag }} - IFS='v' read -r -a VERSION <<< "${{ steps.get-latest-tag.outputs.tag }}" - IFS='.' read -r -a VERSION_PARTS <<< "${VERSION[1]}" - MAJOR=${VERSION_PARTS[0]} - MINOR=${VERSION_PARTS[1]} - PATCH=${VERSION_PARTS[2]} - - if [ "${{ needs.release-type.outputs.release_level }}" = "major" ]; then - MAJOR=$((MAJOR + 1)) - MINOR=$MINOR - PATCH=$PATCH - elif [ "${{ needs.release-type.outputs.release_level }}" = "minor" ]; then - MINOR=$((MINOR + 1)) - PATCH=$PATCH - elif [ "${{ needs.release-type.outputs.release_level }}" = "patch" ]; then - PATCH=$((PATCH + 1)) - fi - - NEXT_TAG="v$MAJOR.$MINOR.$PATCH" - echo "NEXT_TAG=$NEXT_TAG" >> $GITHUB_OUTPUT - - name: List PR comments - id: list-comments - run: | - PR_NUMBER=${{ github.event.pull_request.number }} - COMMENTS=$(curl -s -H "Accept: application/vnd.github.v3+json" \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/comments") - echo "$COMMENTS" > comments.json - - - name: Identify and delete previous comment - run: | - COMMENT_IDS=$(jq -r '.[] | select(.user.login=="github-actions[bot]") | .id' comments.json) - for COMMENT_ID in $COMMENT_IDS; do - echo "Deleting comment ID $COMMENT_ID" - curl -s -X DELETE -H "Accept: application/vnd.github.v3+json" \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/${{ github.repository }}/issues/comments/$COMMENT_ID" - done - - name: Script to comment on PR - uses: actions/github-script@v6 - with: - script: | - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: '🎉 This PR is included in version ${{ steps.next_version.outputs.NEXT_TAG }} 🎉 ' - }) \ No newline at end of file + comment-version: + uses: edx/.github/.github/workflows/expected-release-version.yml@huniafatima/release-expected-version-workflow \ No newline at end of file From 7950a8d69920b2aafbb5de660276c2c49b1a405e Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Tue, 9 Jul 2024 14:08:35 +0500 Subject: [PATCH 03/23] fix: test commit containing fix --- .github/workflows/release-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 742b8cf3..e48a9902 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -5,7 +5,7 @@ name: Comment Expected Release Version on: pull_request: branches: - - master + - "master" jobs: comment-version: From eb273b2a7103d516fe0ca192dd898a54eb758e0f Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 11 Jul 2024 16:41:58 +0500 Subject: [PATCH 04/23] perf: workflow file org changed --- .github/workflows/release-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index e48a9902..2e18f2a3 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -9,4 +9,4 @@ on: jobs: comment-version: - uses: edx/.github/.github/workflows/expected-release-version.yml@huniafatima/release-expected-version-workflow \ No newline at end of file + uses: openedx/.github/.github/workflows/expected-release-version.yml@huniafatima/release-expected-version-workflow \ No newline at end of file From efe11d47d05dc18c1ae013f2e7ecdc6217e66689 Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 11 Jul 2024 16:44:57 +0500 Subject: [PATCH 05/23] perf: workflow file org changed --- .github/workflows/release-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 2e18f2a3..669607e6 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -9,4 +9,4 @@ on: jobs: comment-version: - uses: openedx/.github/.github/workflows/expected-release-version.yml@huniafatima/release-expected-version-workflow \ No newline at end of file + uses: openedx/.github/.github/workflows/expected-release-version.yml@huniafatima-arbi:huniafatima/release-expected-version-workflow \ No newline at end of file From 94c222735d5d0505045d2da3f9cd76713a3bfc4b Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 11 Jul 2024 16:47:26 +0500 Subject: [PATCH 06/23] perf: workflow file org changed --- .github/workflows/release-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 669607e6..e48a9902 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -9,4 +9,4 @@ on: jobs: comment-version: - uses: openedx/.github/.github/workflows/expected-release-version.yml@huniafatima-arbi:huniafatima/release-expected-version-workflow \ No newline at end of file + uses: edx/.github/.github/workflows/expected-release-version.yml@huniafatima/release-expected-version-workflow \ No newline at end of file From 9493a996b61fcb8a89bc6537eefd31955a66c05e Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 8 Aug 2024 15:12:55 +0500 Subject: [PATCH 07/23] chore: what --- .github/workflows/release-version.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index e48a9902..b3571e52 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -8,5 +8,11 @@ on: - "master" jobs: - comment-version: - uses: edx/.github/.github/workflows/expected-release-version.yml@huniafatima/release-expected-version-workflow \ No newline at end of file + test: + runs-on: ubuntu-latest + steps: + - name: Preview semantic-release version + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} + run: npx semantic-release --dry-run --no-ci \ No newline at end of file From c90c135653ed7b46705fac4126704193e60cc702 Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 8 Aug 2024 15:13:56 +0500 Subject: [PATCH 08/23] chore: what --- .github/workflows/release-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index b3571e52..2b046b88 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -15,4 +15,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} - run: npx semantic-release --dry-run --no-ci \ No newline at end of file + run: npx semantic-release@17 --dry-run --no-ci \ No newline at end of file From c3f6492ef4bdfd17193073d42a1a0fb2a77f260e Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 8 Aug 2024 15:16:32 +0500 Subject: [PATCH 09/23] chore: what --- .github/workflows/release-version.yml | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 2b046b88..52e4ae34 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -8,6 +8,34 @@ on: - "master" jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup Nodejs Env + run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VER }} + - name: Install dependencies + run: npm ci + - name: Validate package-lock.json changes + run: make validate-no-uncommitted-package-lock-changes + - name: Lint + run: npm run lint + - name: Test + run: npm run test + - name: i18n_extract + run: npm run i18n_extract + - name: Coverage + uses: codecov/codecov-action@v3 + - name: Build + run: npm run build test: runs-on: ubuntu-latest steps: From 504e4b1aadf2e18a0d3ebdc9ae2d7aa4d07c2aa0 Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 8 Aug 2024 15:19:38 +0500 Subject: [PATCH 10/23] chore: what --- .github/workflows/release-version.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 52e4ae34..153e4bb4 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -36,11 +36,8 @@ jobs: uses: codecov/codecov-action@v3 - name: Build run: npm run build - test: - runs-on: ubuntu-latest - steps: - - name: Preview semantic-release version + - name: Release env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} + GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} run: npx semantic-release@17 --dry-run --no-ci \ No newline at end of file From 661d6da8f696931ca62ac026e0964e9af2ae61b7 Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 8 Aug 2024 15:22:54 +0500 Subject: [PATCH 11/23] chore: what --- .github/workflows/release-version.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 153e4bb4..482d79fa 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -36,8 +36,12 @@ jobs: uses: codecov/codecov-action@v3 - name: Build run: npm run build + - name: Extract branch name + shell: bash + run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT + id: extract_branch - name: Release env: GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} - run: npx semantic-release@17 --dry-run --no-ci \ No newline at end of file + run: npx semantic-release@17 --dry-run --no-ci --branches=${{ steps.extract_branch.outputs.branch }} \ No newline at end of file From d43b8ce1204e831d78d3cc132ec65c34d5172f83 Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 8 Aug 2024 15:29:25 +0500 Subject: [PATCH 12/23] chore: what --- .github/workflows/release-version.yml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 482d79fa..46444b1b 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -24,18 +24,6 @@ jobs: node-version: ${{ env.NODE_VER }} - name: Install dependencies run: npm ci - - name: Validate package-lock.json changes - run: make validate-no-uncommitted-package-lock-changes - - name: Lint - run: npm run lint - - name: Test - run: npm run test - - name: i18n_extract - run: npm run i18n_extract - - name: Coverage - uses: codecov/codecov-action@v3 - - name: Build - run: npm run build - name: Extract branch name shell: bash run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT @@ -44,4 +32,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} - run: npx semantic-release@17 --dry-run --no-ci --branches=${{ steps.extract_branch.outputs.branch }} \ No newline at end of file + run: npx semantic-release@17 --dry-run --no-ci --branches=huniafatima/preview-next-version-on-pr \ No newline at end of file From 0ca623303ae500599d87bd5ca491d166d88fa224 Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 8 Aug 2024 15:31:10 +0500 Subject: [PATCH 13/23] chore: what --- .github/workflows/release-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 46444b1b..3e46e30a 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -32,4 +32,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} - run: npx semantic-release@17 --dry-run --no-ci --branches=huniafatima/preview-next-version-on-pr \ No newline at end of file + run: npx semantic-release@17 --dry-run --no-ci --branches=${{ steps.extract_branch.outputs.branch }} \ No newline at end of file From 38617335186b253bb0b06507f6ede5c33508df6f Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 8 Aug 2024 15:35:35 +0500 Subject: [PATCH 14/23] chore: what --- .github/workflows/release-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 3e46e30a..46444b1b 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -32,4 +32,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} - run: npx semantic-release@17 --dry-run --no-ci --branches=${{ steps.extract_branch.outputs.branch }} \ No newline at end of file + run: npx semantic-release@17 --dry-run --no-ci --branches=huniafatima/preview-next-version-on-pr \ No newline at end of file From fa0da1efa949b55c97a5aa580cd4d1a8572938f0 Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 8 Aug 2024 15:40:20 +0500 Subject: [PATCH 15/23] chore: what --- .github/workflows/release-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 46444b1b..3e46e30a 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -32,4 +32,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} - run: npx semantic-release@17 --dry-run --no-ci --branches=huniafatima/preview-next-version-on-pr \ No newline at end of file + run: npx semantic-release@17 --dry-run --no-ci --branches=${{ steps.extract_branch.outputs.branch }} \ No newline at end of file From 4d47946b88e5dd5e3bebbd24469fc5d78774a4dd Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 8 Aug 2024 15:40:59 +0500 Subject: [PATCH 16/23] chore: what --- .github/workflows/release-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 3e46e30a..86d33be1 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -32,4 +32,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} - run: npx semantic-release@17 --dry-run --no-ci --branches=${{ steps.extract_branch.outputs.branch }} \ No newline at end of file + run: npx semantic-release@17 --dry-run --no-ci --branches=[${{ steps.extract_branch.outputs.branch }}, master] \ No newline at end of file From 994a0604eca4e78598f2072b5d1b603592379faa Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 8 Aug 2024 15:45:53 +0500 Subject: [PATCH 17/23] chore: what --- .github/workflows/release-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 86d33be1..f2eb2f9b 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -32,4 +32,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} - run: npx semantic-release@17 --dry-run --no-ci --branches=[${{ steps.extract_branch.outputs.branch }}, master] \ No newline at end of file + run: npx semantic-release@17 --dry-run --no-ci --branches=[huniafatima/preview-next-version-on-pr, master] \ No newline at end of file From 7f61ef5e8de774dc626b82ac2abb2a3a9a22a4cb Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 8 Aug 2024 15:58:01 +0500 Subject: [PATCH 18/23] chore: what --- .github/workflows/release-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index f2eb2f9b..2ce8e4a2 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -32,4 +32,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} - run: npx semantic-release@17 --dry-run --no-ci --branches=[huniafatima/preview-next-version-on-pr, master] \ No newline at end of file + run: npx semantic-release@17 --dry-run --no-ci --branches=huniafatima/preview-next-version-on-pr,master \ No newline at end of file From 47865437ed242871d32853abd87f434bb410379f Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 8 Aug 2024 16:04:49 +0500 Subject: [PATCH 19/23] chore: what --- .github/workflows/release-version.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 2ce8e4a2..0927e650 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -32,4 +32,9 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} - run: npx semantic-release@17 --dry-run --no-ci --branches=huniafatima/preview-next-version-on-pr,master \ No newline at end of file + run: npx semantic-release@17 --dry-run --no-ci --branches=huniafatima/preview-next-version-on-pr,master + id: version_release + - name: Comment version on PR + run: echo ${{ steps.version_release.outputs.stdout }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 56000f2591d09641fda7aac07a47569c6d2f34c5 Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 8 Aug 2024 16:10:47 +0500 Subject: [PATCH 20/23] chore: what --- .github/workflows/release-version.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 0927e650..9e5e927d 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -35,6 +35,13 @@ jobs: run: npx semantic-release@17 --dry-run --no-ci --branches=huniafatima/preview-next-version-on-pr,master id: version_release - name: Comment version on PR - run: echo ${{ steps.version_release.outputs.stdout }} + run: echo ${{ steps.version_release.outputs.stdout }} | tee comment.txt env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Post PR comment + uses: peter-evans/create-or-update-comment@v3 + with: + issue-number: ${{ github.event.pull_request.number }} + body: | + Next release version: $(grep -oP '(?<=next release version )\S+' <<< ${{ steps.semantic.outputs.stdout }}) \ No newline at end of file From 67328e8f055d9c07955f392e9c6cbeab04e27c8e Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 8 Aug 2024 16:17:34 +0500 Subject: [PATCH 21/23] chore: what --- .github/workflows/release-version.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 9e5e927d..b9cd1014 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -28,20 +28,18 @@ jobs: shell: bash run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT id: extract_branch - - name: Release - env: - GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} - run: npx semantic-release@17 --dry-run --no-ci --branches=huniafatima/preview-next-version-on-pr,master - id: version_release - - name: Comment version on PR - run: echo ${{ steps.version_release.outputs.stdout }} | tee comment.txt - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Run semantic-release in dry-run mode + run: npx semantic-release --dry-run > output.log + + - name: Extract next version + id: extract_version + run: | + VERSION=$(grep -oP '(?<=next release version: )\S+' output.log) + echo "VERSION=$VERSION" >> $GITHUB_ENV - - name: Post PR comment + - name: Comment version on PR uses: peter-evans/create-or-update-comment@v3 with: issue-number: ${{ github.event.pull_request.number }} body: | - Next release version: $(grep -oP '(?<=next release version )\S+' <<< ${{ steps.semantic.outputs.stdout }}) \ No newline at end of file + Next release version: ${{ env.VERSION }} \ No newline at end of file From 3795e9af0d3645b165ec669e27aaa93d235f3145 Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 8 Aug 2024 16:22:02 +0500 Subject: [PATCH 22/23] chore: what --- .github/workflows/release-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index b9cd1014..2be886c6 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -29,7 +29,7 @@ jobs: run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT id: extract_branch - name: Run semantic-release in dry-run mode - run: npx semantic-release --dry-run > output.log + run: npx semantic-release@17 --dry-run > output.log - name: Extract next version id: extract_version From b1b772f244f17a042caabdd7cf0cd6254ab89c53 Mon Sep 17 00:00:00 2001 From: Hunia Fatima Date: Thu, 8 Aug 2024 16:26:06 +0500 Subject: [PATCH 23/23] chore: what --- .github/workflows/release-version.yml | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 2be886c6..2ce8e4a2 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -28,18 +28,8 @@ jobs: shell: bash run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT id: extract_branch - - name: Run semantic-release in dry-run mode - run: npx semantic-release@17 --dry-run > output.log - - - name: Extract next version - id: extract_version - run: | - VERSION=$(grep -oP '(?<=next release version: )\S+' output.log) - echo "VERSION=$VERSION" >> $GITHUB_ENV - - - name: Comment version on PR - uses: peter-evans/create-or-update-comment@v3 - with: - issue-number: ${{ github.event.pull_request.number }} - body: | - Next release version: ${{ env.VERSION }} \ No newline at end of file + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} + run: npx semantic-release@17 --dry-run --no-ci --branches=huniafatima/preview-next-version-on-pr,master \ No newline at end of file