-
Notifications
You must be signed in to change notification settings - Fork 14
55 lines (52 loc) · 1.7 KB
/
release.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
name: Release
on:
push:
branches:
- main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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: Update package.json version from NEXT
run: |
version=$(jq -r '.version' package.json)
regex='(.*)(\-next\.[0-9]+)$'
if [[ $version =~ $regex ]]; then
temp=$(mktemp)
newVersion=$(echo $version | sed -E "s/${regex}/\1/g")
jq ".version=\"$newVersion\"" package.json > "$temp" && mv "$temp" package.json
fi
# - name: Publish to npm
# uses: changesets/action@master
# with:
# publish: yarn release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Update types
run: |
changed=$(git status --porcelain)
if [[ -n "$changed" ]]; then
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
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
if [[ -z "$(git log origin/main..HEAD); then
git push
fi
fi