File tree Expand file tree Collapse file tree 3 files changed +141
-1
lines changed Expand file tree Collapse file tree 3 files changed +141
-1
lines changed Original file line number Diff line number Diff line change
1
+ name : Bump Version
2
+
3
+ permissions :
4
+ contents : write
5
+ pull-requests : write
6
+
7
+ # Only works right now through manual requests
8
+ on :
9
+ push :
10
+ branches :
11
+ - ' cdActions'
12
+ workflow_dispatch :
13
+ branches :
14
+ - ' cdActions'
15
+ - ' master'
16
+ inputs :
17
+ version :
18
+ description : ' Semver type of new version (major / minor / patch)'
19
+ required : false
20
+ type : choice
21
+ default : patch
22
+ options :
23
+ - patch
24
+ - minor
25
+ - major
26
+ workspace :
27
+ description : ' Workspace to release. e.g. @segment/analytics-react-native'
28
+ required : false
29
+ type : string
30
+ default : ' @segment/analytics-react-native'
31
+
32
+ jobs :
33
+ bump-version :
34
+ name : Bump Version
35
+ runs-on : ubuntu-latest
36
+
37
+ steps :
38
+ - name : Check out source
39
+ uses : actions/checkout@v2
40
+
41
+ - name : Setup Node.js
42
+ uses : actions/setup-node@v2
43
+ with :
44
+ node-version : ' 14'
45
+ cache : ' yarn'
46
+
47
+ - name : Install packages
48
+ run : yarn install --frozen-lockfile
49
+
50
+ - name : Build
51
+ run : yarn build
52
+
53
+ - name : Set Environment Variables
54
+ env :
55
+ IS_PUSH : ${{ github.event_name == 'push' }}
56
+ run : |
57
+ if ${IS_PUSH}; then
58
+ echo "VERSION=patch" >> $GITHUB_ENV
59
+ echo "WORKSPACE='@segment/analytics-react-native'" >> $GITHUB_ENV
60
+ echo "Set the default input params: VERSION=patch, WORKSPACE='@segment/analytics-react-native'"
61
+ else
62
+ echo "VERSION=${{github.event.inputs.version}}" >> $GITHUB_ENV
63
+ echo "WORKSPACE=${{github.event.inputs.workspace}}" >> $GITHUB_ENV
64
+ echo "Setting user input params: VERSION=${{github.event.inputs.version}}, WORKSPACE=${{github.event.inputs.workspace}}"
65
+ fi
66
+
67
+
68
+ - name : Bump Version
69
+ run : yarn workspace ${{ env.WORKSPACE }} version --${{ env.VERSION }} --no-git-tag-version
70
+
71
+ - name : Create Pull Request
72
+ uses : peter-evans/create-pull-request@v3
73
+ with :
74
+ commit-message : ' chore: release ${{env.WORKSPACE}} ${{env.VERSION}}'
75
+ title : ' chore: release ${{env.WORKSPACE}} ${{env.VERSION}}'
76
+ delete-branch : true
Original file line number Diff line number Diff line change
1
+ name : Publish
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - ' cdActions'
7
+ tags :
8
+ - ' v*'
9
+ paths :
10
+ - ' packages/core/**'
11
+ # workflow_dispatch:
12
+ # inputs:
13
+ # workspace:
14
+ # description: 'Workspace to publish e.g. @segment/analytics-react-native'
15
+ # required: false
16
+ # type: string
17
+ # default: '@segment/analytics-react-native'
18
+ # secrets:
19
+ # NPM_TOKEN:
20
+ # required: true
21
+
22
+ jobs :
23
+ publish :
24
+ name : Publish to npm
25
+ runs-on : ubuntu-latest
26
+ steps :
27
+ - uses : actions/checkout@v2
28
+
29
+ - uses : actions/setup-node@v2
30
+ with :
31
+ node-version : ' 14'
32
+ cache : ' yarn'
33
+
34
+ - name : Config and Build
35
+ run : |
36
+ npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
37
+ yarn install --frozen-lockfile
38
+ yarn build
39
+ env :
40
+ NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
41
+
42
+ - name : Publish
43
+ working-directory : packages/core
44
+ run : npm publish --tag beta --dry-run
45
+
46
+ create-github-release :
47
+ if : github.event.inputs.workspace == '' || github.event.inputs.workspace == '@segment/analytics-react-native'
48
+ name : Create GitHub Release
49
+ permissions :
50
+ contents : write
51
+ runs-on : ubuntu-latest
52
+ needs : publish
53
+ steps :
54
+ - name : Create Release Notes
55
+
56
+
57
+ with :
58
+ script : |
59
+ await github.request(`POST /repos/${{ github.repository }}/releases`, {
60
+ tag_name: "${{ github.ref }}",
61
+ generate_release_notes: true,
62
+ draft: true
63
+ });
Original file line number Diff line number Diff line change 48
48
},
49
49
"engines" : {
50
50
"node" : " >=12"
51
- }
51
+ },
52
+ "version" : " 0.0.1"
52
53
}
You can’t perform that action at this time.
0 commit comments