-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cfe0c35
commit 3ea566c
Showing
2 changed files
with
75 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,8 @@ | |
name: CI | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- main | ||
pull_request: | ||
types: [opened, reopened] | ||
|
||
jobs: | ||
build: | ||
|
@@ -22,10 +21,81 @@ jobs: | |
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: 'yarn' | ||
cache: "yarn" | ||
|
||
- name: Install dependencies | ||
run: yarn | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
choose-version: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Add version selection comment | ||
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: ` | ||
## Please select the version update for the package: | ||
- 👍 Patch | ||
- 🎉 Minor | ||
- 🚀 Major | ||
React with the appropriate emoji to choose the version. | ||
` | ||
}) | ||
check-version: | ||
runs-on: ubuntu-latest | ||
needs: choose-version | ||
steps: | ||
- name: Check version bump reaction | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const { data: reactions } = await github.rest.reactions.listForIssue({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: context.issue.number | ||
}); | ||
let versionType = 'patch'; // default | ||
reactions.forEach(reaction => { | ||
if (reaction.content === 'rocket') { | ||
versionType = 'major'; | ||
} else if (reaction.content === 'tada') { | ||
versionType = 'minor'; | ||
} | ||
}); | ||
console.log(`Version to bump: ${versionType}`); | ||
core.setOutput('version_type', versionType); | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: check-version | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
registry-url: 'https://registry.npmjs.org/' | ||
|
||
- name: Bump version | ||
run: | | ||
yarn version --${{ needs.check-version.outputs.version_type }} | ||
- name: Push changes and tags | ||
run: | | ||
git config user.email "[email protected]" | ||
git config user.name "vtexgithubbot" | ||
git push --follow-tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,16 +36,7 @@ jobs: | |
- name: Build | ||
run: yarn build | ||
|
||
- name: Update version to patch | ||
run: yarn version --patch | ||
|
||
- name: Publish | ||
run: yarn publish --non-interactive | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Push changes and tags | ||
run: | | ||
git config user.email "[email protected]" | ||
git config user.name "vtexgithubbot" | ||
git push --follow-tags | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |