-
Notifications
You must be signed in to change notification settings - Fork 47
81 lines (78 loc) · 2.87 KB
/
chat-widget-release-manual.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
name: chat-widget-release-manual
on:
workflow_dispatch:
jobs:
build:
runs-on: windows-2019
steps:
- name: Checking out for ${{ github.ref }}
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 20.X
- name: Update package version
working-directory: chat-widget
run: npx version-from-git --no-git-tag-version
if: ${{ startsWith(github.ref, 'refs/heads/') }}
- name: Read package.json
id: read-package-json
working-directory: chat-widget
run: |
echo "::set-output name=name::$(cat package.json | jq -r '.name')"
echo "::set-output name=version::$(cat package.json | jq -r '.version')"
- name: Install packages
working-directory: chat-widget
run: yarn install --network-timeout 100000
- name: Unit Tests
working-directory: chat-widget
run: yarn test:unit
- name: Build Storybook
working-directory: chat-widget
env :
NODE_OPTIONS: --openssl-legacy-provider
run: yarn build-storybook
- name: VRT Tests
working-directory: chat-widget
run: yarn test:visual
- name: Upload VRT Tests failures screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: VRT Failure Screenshots
path: 'chat-widget/**/__diff_output__/*.png'
- name: Build package
working-directory: chat-widget
run: yarn build
- name: Npm packaging
working-directory: chat-widget
run: npm pack
- name: Move package tarball to root
working-directory: chat-widget
run: |
mv *.tgz ../
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
name: npm-tarball
path: '*.tgz'
publish:
needs: build
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/') }}
steps:
- uses: actions/download-artifact@v3
with:
name: npm-tarball
- name: Read package.json
id: read-package-json
run: |
echo "::set-output name=name::$(tar xOf *.tgz package/package.json | jq -r '.name')"
echo "::set-output name=version::$(tar xOf *.tgz package/package.json | jq -r '.version')"
echo "::set-output name=tarball::$(ls *.tgz)"
echo "::set-output name=date::$(date +%Y-%m-%d)"
- name: Run npm publish ${{ steps.read-package-json.outputs.name }}@${{ steps.read-package-json.outputs.version }}
run: |
npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
npm publish *.tgz --tag main --access public
npm dist-tag add ${{ steps.read-package-json.outputs.name }}@${{ steps.read-package-json.outputs.version }} latest