Repository navigation
67 lines (67 loc) · 2.41 KB
/
Copy pathvtest-push.yml
File metadata and controls
67 lines (67 loc) · 2.41 KB
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
name: VisualTest(push)
on:
push:
branches:
- '**'
tags-ignore:
- 'devel.**'
- 'latest.**'
jobs:
release:
name: check version, add tag and release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: main:Cache node modules(yarn.lock)
id: cache
uses: actions/cache@v1
with:
path: main/node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('main/yarn.lock') }}
restore-keys: ${{ runner.OS }}-build-${{ env.cache-name }}-
- name: main:package-install
if: steps.cache.outputs.cache-hit != 'true'
run: yarn --cwd main
- name: main:build
run: yarn --cwd main build
- name: test:Cache node modules(yarn.lock)
id: test-cache
uses: actions/cache@v1
with:
path: test/node_modules
key: ${{ runner.OS }}-build-test-${{ hashFiles('test/yarn.lock') }}
restore-keys: ${{ runner.OS }}-build-${{ env.cache-name }}-
- name: test:package-install
if: steps.test-cache.outputs.cache-hit != 'true'
run: yarn --cwd test
- name: Create capture
run: yarn --cwd test capture
- name: Save capture
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
run: |
BRANCH=`echo $GITHUB_REF | sed 's/^refs\/heads\///'`
cd test/__screenshots__
git init
git remote add origin https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY
git config --global user.name $GITHUB_ACTOR
git config --global user.email ${GITHUB_ACTOR}@git
git checkout -b captures/$BRANCH
git add .
git commit -m $BRANCH
git push -f origin captures/$BRANCH
- name: update npm package version
if: contains(github.ref, 'refs/tags')
uses: SoraKumo001/actions-npm-version-update@release
with:
path: main/package.json
- name: publish
if: contains(github.ref, 'refs/tags')
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd main
a=($(echo $GITHUB_REF | sed -n -r 's/^refs\/tags\/([^-]*)-(.*)$/\1 \2/p')) tag=${a[0]} version=${a[1]}
echo publish $version [$tag]
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
npm publish --tag $tag