-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (164 loc) · 5.49 KB
/
predict_version.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
name: PR Checker
on:
pull_request:
branches:
- 'main'
types: [labeled, opened, synchronize]
workflow_dispatch:
permissions:
contents: write
pull-requests: write
# actions: write
checks: write
# deployments: write
# id-token: write
# issues: write
# discussions: write
# packages: write
# pages: write
# repository-projects: write
# security-events: write
# statuses: write
jobs:
Versioning:
runs-on: ubuntu-latest
steps:
- name: 'check tag labels'
id: check_pr_labels_major
uses: danielchabr/[email protected]
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
hasSome: "Major :star2:,Minor :sparkles:,Patch :bug:,Skip Version"
- name: 'Use Node.js'
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org/
- uses: actions/checkout@v4
with:
ref: "${{ github.base_ref }}"
path: 'main'
- name: 'Master Default version'
run: |
cd main
_pluginVersion=$(node -p "require('./package.json').version")
set -e
echo "PLUGIN_VERSION=${_pluginVersion}" >> $GITHUB_ENV
echo "new version : ${_pluginVersion}"
- name: 'Change patch version'
if: ${{ contains( github.event.pull_request.labels.*.name, 'Patch :bug:') }}
run: |
cd main
npm version patch --git-tag-version false
_pluginVersion=$(node -p "require('./package.json').version")
set -e
echo "PLUGIN_VERSION=${_pluginVersion}" >> $GITHUB_ENV
echo "new version : ${_pluginVersion}"
- name: 'Change Minor version'
if: ${{ contains( github.event.pull_request.labels.*.name, 'Minor :sparkles:') }}
run: |
cd main
npm version minor --git-tag-version false
_pluginVersion=$(node -p "require('./package.json').version")
set -e
echo "PLUGIN_VERSION=${_pluginVersion}" >> $GITHUB_ENV
echo "new version : ${_pluginVersion}"
- name: 'Change Major version'
if: ${{ contains( github.event.pull_request.labels.*.name, 'Major :star2:')}}
run: |
cd main
npm version major --git-tag-version false
_pluginVersion=$(node -p "require('./package.json').version")
set -e
echo "PLUGIN_VERSION=${_pluginVersion}" >> $GITHUB_ENV
echo "new version : ${_pluginVersion}"
- name: 'Cleanup main'
run: |
rm -rf main
- name: Get Source branch
if: ${{ steps.check_pr_labels_major.outputs.passed }} == true
uses: actions/checkout@v3
with:
ref: "${{ github.head_ref || github.ref_name }}"
- name: History
if: ${{ steps.check_pr_labels_major.outputs.passed }} == true
uses: jitterbit/get-changed-files@v1
id: history
- name: Check whatsnew.md status
if: ${{ steps.check_pr_labels_major.outputs.passed }} == true
id: whatsnew
run: |
_isFilechanged=false
for changed_file in ${{ steps.history.outputs.modified }}; do
if [[ ${changed_file} == *"whatsnew.md"* ]]; then
_isFilechanged=true
fi
done
echo "passed=${_isFilechanged}" >> $GITHUB_OUTPUT
- name: Failed whatsnew.md status
if: ${{ steps.whatsnew.outputs.passed == 'false'}}
run: |
echo "::error::You have miss to update whatsnew.md with latest changes"
exit 1
- name: Commit and push changes
if: ${{ steps.check_pr_labels_major.outputs.passed }} == true
uses: devops-infra/action-commit-push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
commit_message: "Updated ${{ env.PLUGIN_VERSION }}"
commit_prefix: "[AUTO]"
force: false
react_ios:
needs: Versioning
runs-on: macos-14
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org/
- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
- name: Build it
run: |
npm install
export USE_FRAMEWORKS=dynamic
export NO_FLIPPER=1
cd example && npm install
npx pod-install
- name: Run test
run: |
npm run build
#npm test
#yarn example run ios
# react_android:
# needs: react_ios
# runs-on: macos-14
# steps:
# - name: Check out Git repository
# uses: actions/checkout@v2
# - name: Use Node.js
# uses: actions/setup-node@v3
# with:
# node-version: 16.x
# registry-url: https://registry.npmjs.org/
# - name: set up JDK 11
# uses: actions/setup-java@v1
# with:
# java-version: 11.0.15
# - name: Build it
# run: |
# yarn
# cd example
# yarn
# - name: run tests
# uses: reactivecircus/android-emulator-runner@v2
# with:
# api-level: 29
# emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim
# script: yarn example run android