1- on :
2- pull_request :
3- push :
4- branches :
5- - master
6- tags :
7- - " !*"
1+ on : push
82
93name : CI
104
159 env :
1610 LINT : 1
1711 steps :
12+ - name : Set running flag
13+ run : echo "::set-env name=RUNNING::1"
1814 - uses : actions/checkout@v2
1915 - uses : technote-space/get-git-comment-action@v1
2016 - uses : technote-space/get-diff-action@v1
2117 with :
18+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2219 PREFIX_FILTER : |
2320 src/
2421 __tests__/
25- SUFFIX_FILTER : .js
22+ SUFFIX_FILTER : |
23+ .js
24+ .ts
2625 FILES : .eslintrc
2726 if : " ! contains(env.COMMIT_MESSAGE, '[skip ci]') && ! contains(env.COMMIT_MESSAGE, '[ci skip]')"
27+ - name : Set running flag
28+ run : echo "::set-env name=RUNNING::"
29+ if : " ! env.GIT_DIFF"
30+
2831 - name : Get Yarn Cache Directory
2932 id : yarn-cache
3033 run : echo "::set-output name=dir::$(yarn cache dir)"
31- if : env.GIT_DIFF
34+ if : env.RUNNING
3235 - name : Cache node dependencies
3336 uses : actions/cache@v1
3437 with :
3538 path : ${{ steps.yarn-cache.outputs.dir }}
3639 key : ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
3740 restore-keys : |
3841 ${{ runner.os }}-yarn-
39- if : env.GIT_DIFF
42+ if : env.RUNNING
4043 - name : Install Package dependencies
4144 run : yarn install
42- if : env.GIT_DIFF
45+ if : env.RUNNING
4346 - name : Check code style
4447 run : yarn eslint ${{ env.GIT_DIFF }}
45- if : env.GIT_DIFF
46- - uses : 8398a7/action-slack@v1
48+ if : env.RUNNING
49+ - uses : 8398a7/action-slack@v2
4750 with :
48- type : failure
51+ status : failure
4952 env :
5053 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5154 SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
@@ -57,45 +60,61 @@ jobs:
5760 runs-on : ubuntu-latest
5861 strategy :
5962 matrix :
60- node : ['10', ' 11', '12']
63+ node : ['11', '12']
6164 steps :
65+ - name : Set running flag
66+ run : echo "::set-env name=RUNNING::1"
6267 - uses : actions/checkout@v2
6368 - uses : technote-space/get-git-comment-action@v1
6469 - uses : technote-space/get-diff-action@v1
6570 with :
71+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6672 PREFIX_FILTER : |
6773 src/
6874 __tests__/
6975 SUFFIX_FILTER : |
7076 .js
77+ .ts
7178 .snap
7279 FILES : |
7380 yarn.lock
7481 jest.config.js
7582 if : " ! contains(env.COMMIT_MESSAGE, '[skip ci]') && ! contains(env.COMMIT_MESSAGE, '[ci skip]')"
83+ - name : Set running flag
84+ run : echo "::set-env name=RUNNING::"
85+ if : " ! env.GIT_DIFF"
86+ - name : Set running flag
87+ if : matrix.node == '12' && startsWith(github.ref, 'refs/tags/')
88+ run : echo "::set-env name=RUNNING::1"
89+ - name : Set running flag
90+ run : |
91+ if [[ ! -f package.json ]] || ! < package.json jq -r '.scripts | keys[]' | grep -qe '^cover$'; then
92+ echo "::set-env name=RUNNING::"
93+ fi
94+
7695 - name : Setup node
7796 uses : actions/setup-node@v1
7897 with :
7998 node-version : ${{ matrix.node }}
80- if : env.GIT_DIFF || github.event_name == 'push'
99+ if : env.RUNNING
81100 - name : Get Yarn Cache Directory
82101 id : yarn-cache
83102 run : echo "::set-output name=dir::$(yarn cache dir)"
84- if : env.GIT_DIFF || github.event_name == 'push'
103+ if : env.RUNNING
85104 - name : Cache node dependencies
86105 uses : actions/cache@v1
87106 with :
88107 path : ${{ steps.yarn-cache.outputs.dir }}
89108 key : ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
90109 restore-keys : |
91110 ${{ runner.os }}-yarn-
92- if : env.GIT_DIFF || github.event_name == 'push'
111+ if : env.RUNNING
93112 - name : Install Package dependencies
94113 run : yarn install
95- if : env.GIT_DIFF || github.event_name == 'push'
114+ if : env.RUNNING
96115 - name : Run tests
97116 run : yarn cover
98- if : env.GIT_DIFF || github.event_name == 'push'
117+ if : env.RUNNING
99118 - name : Codecov
100119 run : |
101120 if [ -n "$CODECOV_TOKEN" ]; then
@@ -104,23 +123,192 @@ jobs:
104123 env :
105124 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
106125 COVERAGE_FILE : ./coverage/lcov.info
107- if : matrix.node == '12' && (env.GIT_DIFF || github.event_name == 'push')
108- - uses : 8398a7/action-slack@v1
126+ if : env.RUNNING && matrix.node == '12'
127+ - uses : 8398a7/action-slack@v2
128+ with :
129+ status : failure
130+ env :
131+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
132+ SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
133+ if : failure()
134+
135+ package :
136+ name : Publish Package
137+ needs : jest
138+ runs-on : ubuntu-latest
139+ if : startsWith(github.ref, 'refs/tags/v')
140+ strategy :
141+ matrix :
142+ target : ['npm']
143+ steps :
144+ - uses : actions/checkout@v2
145+ - name : Setup Node.js
146+ uses : actions/setup-node@v1
147+ with :
148+ node-version : 12
149+ registry-url : https://registry.npmjs.org/
150+ if : matrix.target == 'npm'
151+ - name : Setup Node.js
152+ uses : actions/setup-node@v1
153+ with :
154+ node-version : 12
155+ registry-url : https://npm.pkg.github.com
156+ if : matrix.target == 'gpr'
157+ - name : Get Yarn Cache Directory
158+ id : yarn-cache
159+ run : echo "::set-output name=dir::$(yarn cache dir)"
160+ - name : Cache node dependencies
161+ uses : actions/cache@v1
162+ with :
163+ path : ${{ steps.yarn-cache.outputs.dir }}
164+ key : ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
165+ restore-keys : |
166+ ${{ runner.os }}-yarn-
167+
168+ - name : Check package version
169+ uses : technote-space/package-version-check-action@v1
170+ with :
171+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
172+ COMMIT_DISABLED : 1
173+ - name : Install Package dependencies
174+ run : yarn install
175+ - name : Build
176+ run : yarn build
177+ - name : Publish
178+ run : |
179+ if [ -n "$NPM_AUTH_TOKEN" ]; then
180+ npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN
181+ npm publish
182+ fi
183+ env :
184+ NPM_AUTH_TOKEN : ${{ secrets.NPM_AUTH_TOKEN }}
185+ if : matrix.target == 'npm'
186+ - name : Publish
187+ run : |
188+ if [ -n "$NPM_AUTH_TOKEN" ]; then
189+ npm publish
190+ fi
191+ env :
192+ NODE_AUTH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
193+ if : matrix.target == 'gpr'
194+ - uses : 8398a7/action-slack@v2
109195 with :
110- type : failure
196+ status : failure
111197 env :
112198 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
113199 SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
114200 if : failure()
115201
116- slack :
117- name : Slack
202+ pages :
203+ name : Publish GitHub Pages
118204 needs : jest
119205 runs-on : ubuntu-latest
206+ if : startsWith(github.ref, 'refs/tags/v')
120207 steps :
121- - uses : 8398a7/action-slack@v1
208+ - uses : actions/checkout@v2
209+ with :
210+ persist-credentials : false
211+ - name : Get Yarn Cache Directory
212+ id : yarn-cache
213+ run : echo "::set-output name=dir::$(yarn cache dir)"
214+ - name : Cache node dependencies
215+ uses : actions/cache@v1
216+ with :
217+ path : ${{ steps.yarn-cache.outputs.dir }}
218+ key : ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
219+ restore-keys : |
220+ ${{ runner.os }}-yarn-
221+
222+ - name : Install Package dependencies
223+ run : yarn install
224+ - name : Build
225+ run : |
226+ git clone --depth=1 https://github.com/wp-content-framework/travis-ci.git travis-ci
227+ bash travis-ci/bin/deploy/gh-pages.sh
228+ env :
229+ TRAVIS_BUILD_DIR : ${{ github.workspace }}
230+ GH_PAGES_TITLE : jQuery Marker Animation
231+ GH_PAGES_TRACKING_ID : UA-78163306-3
232+ - name : Deploy
233+ uses : JamesIves/github-pages-deploy-action@releases/v3
234+ with :
235+ ACCESS_TOKEN : ${{ secrets.ACCESS_TOKEN }}
236+ BRANCH : gh-pages
237+ FOLDER : gh-pages
238+ - uses : 8398a7/action-slack@v2
239+ with :
240+ status : failure
241+ env :
242+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
243+ SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
244+ if : failure()
245+
246+ releases :
247+ name : Upload build files
248+ needs : jest
249+ runs-on : ubuntu-latest
250+ if : startsWith(github.ref, 'refs/tags/v')
251+ steps :
252+ - uses : actions/checkout@v2
253+ - name : Get Yarn Cache Directory
254+ id : yarn-cache
255+ run : echo "::set-output name=dir::$(yarn cache dir)"
256+ - name : Cache node dependencies
257+ uses : actions/cache@v1
258+ with :
259+ path : ${{ steps.yarn-cache.outputs.dir }}
260+ key : ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
261+ restore-keys : |
262+ ${{ runner.os }}-yarn-
263+
264+ - name : Install Package dependencies
265+ run : yarn install
266+ - name : Build
267+ run : yarn build
268+ - name : Upload
269+ uses : technote-space/action-gh-release@v2
270+ with :
271+ files : build/index.js
272+ draft : true
273+ env :
274+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
275+ - uses : 8398a7/action-slack@v2
276+ with :
277+ status : failure
278+ env :
279+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
280+ SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
281+ if : failure()
282+
283+ publishRelease :
284+ name : Create Release
285+ needs : [package, pages, releases]
286+ runs-on : ubuntu-latest
287+ steps :
288+ - name : Get version
289+ run : echo "::set-env name=TAG_NAME::${HEAD_REF#refs/tags/}"
290+ env :
291+ HEAD_REF : ${{ github.ref }}
292+ - name : Create Release
293+ id : drafter
294+ uses : technote-space/release-drafter@v6
295+ with :
296+ GITHUB_TOKEN : ${{ secrets.ACCESS_TOKEN }}
297+ DRAFT : false
298+ NAME : ${{ env.TAG_NAME }}
299+ TAG : ${{ env.TAG_NAME }}
300+ - uses : 8398a7/action-slack@v2
301+ with :
302+ status : ${{ job.status }}
303+ text : ${{ format('<{0}>', steps.drafter.outputs.html_url) }}
304+ env :
305+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
306+ SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
307+ if : always() && steps.drafter.outputs.html_url
308+ - uses : 8398a7/action-slack@v2
122309 with :
123- type : success
310+ status : ${{ job.status }}
124311 env :
125312 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
126313 SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
314+ if : always() && ! steps.drafter.outputs.html_url
0 commit comments