-
Notifications
You must be signed in to change notification settings - Fork 86
135 lines (112 loc) · 4.71 KB
/
main.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: 'Release new version'
on:
push:
branches:
- master
jobs:
release:
# uncomment next line as soon as visual tesing starts working
# needs: visual_test
name: Release tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check for release commit
id: 'is_release_commit'
uses: /innovaccer/design-system/actions/check-release-commit@master
- uses: actions/setup-node@v1
if: steps.is_release_commit.outputs.result == 1
with:
node-version: '14.x'
- name: npm install
if: steps.is_release_commit.outputs.result == 1
run: npm ci
- name: test
if: steps.is_release_commit.outputs.result == 1
run: npm run test
- name: Upload coverage to Codecov
if: steps.is_release_commit.outputs.result == 1
uses: codecov/codecov-action@v1
- name: setup git
if: steps.is_release_commit.outputs.result == 1
run: git checkout -b preparing-module-for-npm-publish && git config --global user.email "release-bot@innovaccer.com" && git config --global user.name "release-bot"
- name: bump module version
if: steps.is_release_commit.outputs.result == 1
run: RELEASE_COMMIT=true npm version --allow-same-version --no-commit-hooks $(git log -1 --pretty=format:%s) -m "Released %s"
- name: gnerate .npmrc
if: steps.is_release_commit.outputs.result == 1
run: cp .npmrc.stub .npmrc
- name: Publish to npmjs
if: steps.is_release_commit.outputs.result == 1
run: npm publish --access public
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
- name: remove .npmrc
if: steps.is_release_commit.outputs.result == 1
run: rm -rf .npmrc
- name: push module tags to github
if: steps.is_release_commit.outputs.result == 1
run: git push https://${{ secrets.GH_TOKEN }}@github.com/$GITHUB_REPOSITORY.git $(git log -2 --pretty=format:%B | tail -n1)
# Note : not working due to limitation of github actions to push to protected branches.
# Error example : remote: error: GH006: Protected branch update failed for refs/heads/docs.
# Please add updated version in package.json while adding the release commit itself.
# - name: remove css/dist dist/ from commit
# if: steps.is_release_commit.outputs.result == 1
# run: |
# git reset HEAD~1
# git add package.json
# git commit -m "Released $(git log -1 --pretty=format:%s)" --no-verify
# - name: push version to github
# if: steps.is_release_commit.outputs.result == 1
# run: git push https://${{ secrets.GH_TOKEN }}@github.com/$GITHUB_REPOSITORY.git HEAD:master
- name: deploy storybook
if: steps.is_release_commit.outputs.result == 1
run: npm run deploy-storybook -- --bucket-path=webui-mds-sb-prod --aws-profile=NONE --ci
env:
AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_KEY_ID }}
AWS_REGION: ${{ secrets.DOCS_REGION }}
- name: notify release
if: steps.is_release_commit.outputs.result == 1
uses: /innovaccer/design-system/actions/notify-release@master
env:
GCHAT_PATH: ${{ secrets.GCHAT_PATH }}
site_deploy:
name: Deploy docs site
needs: release
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./docs
env:
DOCS_BUCKET: webui-mds-docs-prod
steps:
- uses: actions/checkout@v2
- name: Check for release commit
id: 'is_release_commit'
uses: /innovaccer/design-system/actions/check-release-commit@master
- uses: actions/setup-node@v1
if: steps.is_release_commit.outputs.result == 1
with:
node-version: '14.x'
- name: npm install
if: steps.is_release_commit.outputs.result == 1
run: npm i
- name: extract stories
if: steps.is_release_commit.outputs.result == 1
run: npm run extract
env:
STORYBOOK_HOST: 'https://mds.innovaccer.com/iframe.html?id=indicators-avatargroup-all--all&args=&viewMode=story'
- name: build
if: steps.is_release_commit.outputs.result == 1
run: npm run build
env:
DOCS_BUCKET: webui-mds-docs-prod
- name: deploy
if: steps.is_release_commit.outputs.result == 1
run: npm run deploy && aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths "/*"
env:
AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_KEY_ID }}
AWS_REGION: ${{ secrets.DOCS_REGION }}
DOCS_BUCKET: webui-mds-docs-prod