-
Notifications
You must be signed in to change notification settings - Fork 63
94 lines (90 loc) · 2.83 KB
/
publish-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
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
89
90
91
92
93
94
name: Publish new version
on:
workflow_dispatch:
inputs:
version:
required: true
env:
NODE_VERSION: 16.x
TOOLKIT_VERSION: ${{ inputs.version }}
jobs:
publish:
if: github.repository_owner == 'AxaFrance'
environment:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.PUSH_PAT }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm run check
- run: npm test -- --coverage
- name: Build storybook
run: npm run storybook:build
- name: Upload Storybook into workflow artifact
uses: actions/upload-artifact@v3
with:
name: storybook
path: storybook-static
- name: Git config
run: |
git config user.name "Build-CI"
git config user.email "[email protected]"
- name: Create new release
run: npx lerna version ${TOOLKIT_VERSION} --exact --force-publish --yes --no-push
env:
TOOLKIT_VERSION: ${{ inputs.version }}
- run: |
git push
git push --tags origin
- name: Publish release packages to npm
run: npx lerna publish from-package --yes --registry https://registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
deploy-storybook:
runs-on: ubuntu-latest
needs: publish
defaults:
run:
working-directory: gh-pages/react-toolkit
outputs:
previousVersion: ${{ steps.rename-latest-storybook.outputs.prevVersion }}
steps:
- name: Checkout Axa Github Pages
uses: actions/checkout@v3
with:
repository: AxaFrance/AxaFrance.github.io
ref: master
path: gh-pages
token: ${{ secrets.PUSH_PAT }}
- name: Rename latest Storybook folder
id: rename-latest-storybook
run: |
prevVersion=`node -p "require('./latest/version.json').version"`
mv latest v$prevVersion
echo "::set-output name=prevVersion::$prevVersion"
- uses: actions/download-artifact@v3
with:
name: storybook
path: gh-pages/react-toolkit/latest/storybook
- name: Add version json file into latest
run: |
echo {\"version\":\"${TOOLKIT_VERSION}\"} >> ./latest/version.json
- name: Git config
run: |
git config user.name "Build-CI"
git config user.email "[email protected]"
- name: Add files
run: git add .
- name: Commit changes
run: git commit -a -m "publish storybook ${TOOLKIT_VERSION}"
- name: Push
run: git push