-
Notifications
You must be signed in to change notification settings - Fork 17
88 lines (75 loc) · 2.45 KB
/
publish.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
on:
pull_request:
branches:
- master
jobs:
build-and-publish:
name: Build Jopi & Publish New Version in NPM
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Creating and switching branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git switch -c "publish"
git push --set-upstream origin publish
- name: Installing node
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- name: Installing yarn
run: |
yarn install
- name: Run tests
run: yarn test
- name: Run coverage
run: yarn jest --coverage
- name: Build Jopi
run: yarn build
- name: Set Git config
run: |
git config --global user.email "${{secrets.GIT_EMAIL}}"
git config --global user.name "${{secrets.GIT_USER}}"
- name: Update lerna packages
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
lerna version patch --yes --force-publish
# cd node_modules/.bin
# lerna version patch --yes --force-publish=*
# lerna version --no-push # => this don't fail, but don't change anithing
# yarn lerna publish --yes --registry https://registry.npmjs.org/:_authToken=${NPM_TOKEN}
- name: "NPM Identity"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
- name: Publish New Jopi version to NPM
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
lerna publish from-git --no-private --force-publish --no-push --yes
merge-me:
name: Merge to master
needs:
- build-and-publish
runs-on: ubuntu-latest
steps:
- name: Merge me!
uses: ridedott/merge-me-action@master
with:
# This must be used as GitHub Actions token does not support
# pushing to protected branches.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Delete publish branch
run: |
git checkout master
git branch -d publish