-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (63 loc) · 2.03 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
56
57
58
59
60
61
62
63
name: Release
on:
- push
jobs:
build:
name: Release
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-latest'
node-version:
- '18'
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
- run: npm i
- run: npm run format
- name: commit auto fixes
env:
USERNAME: ${{ github.actor }}
BRANCH: ${{ github.ref_name }}
REPO: ${{ github.repository }}
TOKEN: ${{ secrets.GH_TOKEN }}
run: |
if [ "$(git diff --quiet && echo 0 || echo $?)" -gt 0 ]; then
git config --global user.email "${USERNAME}@users.noreply.github.com" --replace-all
git config --global user.name "$USERNAME" --replace-all
git commit -am "😎 Autofix"
git remote set-url origin https://${TOKEN}@github.com/$REPO.git
git push origin $BRANCH
exit 1
fi
- run: npm run build
- run: npm t -- -u
- name: commit auto fixes
env:
USERNAME: ${{ github.actor }}
BRANCH: ${{ github.ref_name }}
REPO: ${{ github.repository }}
TOKEN: ${{ secrets.GH_TOKEN }}
run: |
if [ "$(git diff --quiet && echo 0 || echo $?)" -gt 0 ]; then
git config --global user.email "${USERNAME}@users.noreply.github.com" --replace-all
git config --global user.name "$USERNAME" --replace-all
git commit -am "😎 Autofix"
git remote set-url origin https://${TOKEN}@github.com/$REPO.git
git push origin $BRANCH
exit 1
fi
- name: Add NPM token
if: github.ref == 'refs/heads/main'
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- name: Build and Publish
if: github.ref == 'refs/heads/main'
run: npx @lets/publish