-
Notifications
You must be signed in to change notification settings - Fork 14
49 lines (45 loc) · 1.57 KB
/
release-next.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
name: Release NEXT
on:
push:
branches:
- next
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- run: yarn --frozen-lockfile
- run: yarn test
- name: Publish next to npm
if: github.ref == 'refs/heads/next'
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
# check whether version is same as current, bump next
current=$(jq -r '.version' package.json)
published=$(npm view svelte-themer@next version)
if [[ $current == $published ]]; then
echo 'version already published, updating package.json'
npm version prerelease --preid=next -m "[automated] update version"
fi
# publish @next, this will build types
# yarn publish --tag next
# check differences and commit back to repo
changed=$(git status --porcelain)
if [[ -n "$changed" ]]; then
if [[ ! `git diff --quiet HEAD -- types` ]]; then
git add types
git commit -m "[automated] update types"
fi
if [[ ! `git diff --quiet HEAD -- package.json` ]]; then
git add package.json
git commit -m "[automated] update version"
fi
git push
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}