@@ -22,10 +22,81 @@ jobs:
22
22
uses : actions/setup-node@v4
23
23
with :
24
24
node-version : 18
25
- cache : ' yarn'
25
+ cache : " yarn"
26
26
27
27
- name : Install dependencies
28
28
run : yarn
29
29
30
30
- name : Build
31
31
run : yarn build
32
+
33
+ choose-version :
34
+ runs-on : ubuntu-latest
35
+
36
+ steps :
37
+ - name : Add version selection comment
38
+ uses : actions/github-script@v6
39
+ with :
40
+ script : |
41
+ github.rest.issues.createComment({
42
+ issue_number: context.issue.number,
43
+ owner: context.repo.owner,
44
+ repo: context.repo.repo,
45
+ body: `
46
+ ## Please select the version update for the package:
47
+ - 👍 Patch
48
+ - 🎉 Minor
49
+ - 🚀 Major
50
+
51
+ React with the appropriate emoji to choose the version.
52
+ `
53
+ })
54
+
55
+ check-version :
56
+ runs-on : ubuntu-latest
57
+ needs : choose-version
58
+ steps :
59
+ - name : Check version bump reaction
60
+ uses : actions/github-script@v6
61
+ with :
62
+ script : |
63
+ const { data: reactions } = await github.rest.reactions.listForIssue({
64
+ owner: context.repo.owner,
65
+ repo: context.repo.repo,
66
+ issue_number: context.issue.number
67
+ });
68
+
69
+ let versionType = 'patch'; // default
70
+ reactions.forEach(reaction => {
71
+ if (reaction.content === 'rocket') {
72
+ versionType = 'major';
73
+ } else if (reaction.content === 'tada') {
74
+ versionType = 'minor';
75
+ }
76
+ });
77
+
78
+ console.log(`Version to bump: ${versionType}`);
79
+ core.setOutput('version_type', versionType);
80
+
81
+ release :
82
+ runs-on : ubuntu-latest
83
+ needs : check-version
84
+ steps :
85
+ - name : Checkout code
86
+ uses : actions/checkout@v3
87
+
88
+ - name : Setup Node.js
89
+ uses : actions/setup-node@v3
90
+ with :
91
+ node-version : ' 18'
92
+ registry-url : ' https://registry.npmjs.org/'
93
+
94
+ - name : Bump version
95
+ run : |
96
+ yarn version --${{ needs.check-version.outputs.version_type }}
97
+
98
+ - name : Push changes and tags
99
+ run : |
100
+ git config user.email "[email protected] "
101
+ git config user.name "vtexgithubbot"
102
+ git push --follow-tags
0 commit comments