File tree Expand file tree Collapse file tree 4 files changed +98
-5
lines changed
Expand file tree Collapse file tree 4 files changed +98
-5
lines changed Original file line number Diff line number Diff line change 66 workflow_dispatch :
77 inputs :
88 version :
9- description : Version number (ex. "2.1.20 ")
9+ description : Version number (ex. "2.1.133 ")
1010 required : true
11- default : 2.1.20
11+ default : 2.1.133
1212 ticket :
1313 description : LINBEE-XXXX ticket number
1414 default : LINBEE-8514
1515 required : false
1616 description :
1717 description : Add a description for this version
1818 required : false
19+ auto-deploy :
20+ description : Add label "auto-deploy" to PR
21+ required : false
22+ type : boolean
23+ default : true
24+
1925jobs :
2026 publish_pr :
2127 name : Publish PR
2733 run : |
2834 echo "VERSION=${{ inputs.version }}" >> "$GITHUB_ENV"
2935 echo "BRANCH_NAME=${{ inputs.ticket }}-bump-gitstream-core-to-${{ inputs.version }}" >> "$GITHUB_ENV"
36+ echo "LABEL_ARG=" >> "$GITHUB_ENV"
37+
38+ - name : Set auto-deploy label
39+ if : inputs.auto-deploy
40+ run : |
41+ echo "LABEL_ARG=--label auto-deploy" >> "$GITHUB_ENV"
3042
3143 - name : Init npmrc
3244 run : |
5365 --title "Bump \`@linearb/gitstream-core\` to \`${{ env.VERSION }}\`" \
5466 --body-file pr_description.txt \
5567 --head ${{ env.BRANCH_NAME }} \
56- --reviewer ${{ github.actor }}
68+ --reviewer ${{ github.actor }} ${{ env.LABEL_ARG }}
Original file line number Diff line number Diff line change 1+ name : Create Tag on merge
2+
3+ on :
4+ workflow_dispatch :
5+ push :
6+ branches :
7+ - develop
8+ paths :
9+ - src/**
10+ - dist/**
11+ - package*.json
12+
13+ jobs :
14+ create-tag :
15+ runs-on : ubuntu-24.04
16+ timeout-minutes : 15
17+
18+ steps :
19+ - uses : actions/checkout@v4
20+ - uses : actions/setup-node@v4
21+ with :
22+ node-version-file : .nvmrc
23+
24+ - name : Create and push new tag
25+ run : npm run create-tag
26+
27+ - name : Get latest commit
28+ id : get-commit
29+ run : echo "LAST_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
30+
31+ - name : Check for associated pull request and auto-deploy label
32+ id : should-deploy
33+ uses : actions/github-script@v7
34+ with :
35+ github-token : ${{ secrets.GITHUB_TOKEN }}
36+ script : |
37+ const { owner, repo } = context.repo;
38+ const commit_sha = '${{ env.LAST_SHA }}';
39+ const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({ commit_sha, owner, repo });
40+ if (prs?.length > 0) {
41+ const pull_number = prs[0].number;
42+ const { data: pr } = await github.rest.pulls.get({ owner, repo, pull_number });
43+ return pr.labels.some(label => label.name.includes('auto-deploy'));
44+ }
45+ return false;
46+
47+ - name : Create GitHub Release & Deploy
48+ if : steps.should-deploy.outputs.result == 'true'
49+ env :
50+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
51+ run : |
52+ gh release create $NEW_TAG --generate-notes
53+ git checkout $NEW_TAG
54+ npm run update-v2-tag
Original file line number Diff line number Diff line change 3131 "lint" : " eslint . -c ./.github/linters/.eslintrc.yml" ,
3232 "package" : " ncc build --minify src/index.ts -o dist --license licenses.txt" ,
3333 "test" : " jest" ,
34- "all" : " npm run format:write && npm run lint && npm run test && npm run package"
34+ "all" : " npm run format:write && npm run lint && npm run test && npm run package" ,
35+ "create-tag" : " ./scripts/tag-version.sh" ,
36+ "update-v2-tag" : " git tag v2 -f && git push origin v2 -f"
3537 },
3638 "license" : " Apache-2.0" ,
3739 "dependencies" : {
8587 " ./src/**"
8688 ]
8789 }
88- }
90+ }
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ git fetch --tags
4+
5+ # Get the latest tag
6+ latest_tag=$( git describe --tags ` git rev-list --tags --max-count=1` )
7+
8+ # Check if the latest tag starts with 'v' and remove it
9+ if [[ $latest_tag == v* ]]; then
10+ latest_tag=${latest_tag: 1}
11+ fi
12+
13+ # Split the latest tag into an array
14+ IFS=' .' read -r -a version_parts <<< " $latest_tag"
15+
16+ # Bump the patch version
17+ new_tag=" ${version_parts[0]} .${version_parts[1]} .$(( version_parts[2 ] + 1 )) "
18+
19+ # Create and push the new tag
20+ git tag $new_tag
21+ git push origin $new_tag
22+ echo " new_tag=$new_tag "
23+
24+ echo " new_tag=$new_tag " >> $GITHUB_OUTPUT
25+ echo " NEW_TAG=$new_tag " >> $GITHUB_ENV
You can’t perform that action at this time.
0 commit comments