-
Notifications
You must be signed in to change notification settings - Fork 30
107 lines (103 loc) · 3.55 KB
/
publish-slash.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
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Publish slash
on:
push:
branches:
- "releases-slash/*"
- main
workflow_dispatch:
permissions:
contents: write
id-token: write
jobs:
build:
if: github.repository_owner == 'AxaFrance'
runs-on: ubuntu-latest
outputs:
version: ${{ steps.gitversion.outputs.fullSemVer }}
isStableRelease: ${{ steps.gitversion.outputs.preReleaseTag == '' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "*" # Use the LTS Node.js version
cache: "npm"
registry-url: "https://registry.npmjs.org"
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v3.0.0
with:
versionSpec: "5.x"
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v3.0.0
with:
useConfigFile: true
configFilePath: "GitVersion-slash.yml"
- run: npm run package:check
- run: npm ci
- run: npm run build:slash
- run:
npm version "${{ steps.gitversion.outputs.fullSemVer }}" -w slash/css
-w slash/react
- name:
Set to react package the @axa-fr/design-system-slash-css dependency
version
run: |
cd slash/react
jq '.peerDependencies["@axa-fr/design-system-slash-css"] = "${{ steps.gitversion.outputs.fullSemVer }}"' package.json > temp.json && mv temp.json package.json
- run: |
if [ "${{ steps.gitversion.outputs.preReleaseTag }}" = "" ]; then
npm publish -w slash/css -w slash/react --access public --tag latest;
else
npm publish -w slash/css -w slash/react --access public --tag next;
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: create artifact folder
run: mkdir -p artifact/css & mkdir -p artifact/react
- name: move storybooks to artifact folders
run:
cp -R slash/css/storybook-static/* artifact/css & cp -R
slash/react/storybook-static/* artifact/react
- uses: actions/upload-artifact@v4
with:
name: storybooks
path: |
artifact
retention-days: 2
deploy:
needs: build
if: needs.build.outputs.isStableRelease == 'true'
runs-on: ubuntu-latest
name: Deploy new version of storybook to gh-pages
steps:
- name: Download storybooks
uses: actions/download-artifact@v4
with:
name: storybooks
- name: Upload the latest react storybook
uses: peaceiris/actions-gh-pages@v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./react
destination_dir: slash/react/latest
- name: Upload the react storybook to its version folder
uses: peaceiris/actions-gh-pages@v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./react
destination_dir: slash/react/${{ needs.build.outputs.version }}
- name: Upload the latest css storybook
uses: peaceiris/actions-gh-pages@v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./css
destination_dir: slash/css/latest
- name: Upload the css to its version folder
uses: peaceiris/actions-gh-pages@v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./css
destination_dir: slash/css/${{ needs.build.outputs.version }}