forked from asyncapi/asyncapi-react
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (105 loc) · 5.04 KB
/
release-wc-and-playground.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
name: Release Web-component and Playground
on:
release:
types:
- published
jobs:
webcomponent:
name: Release Web-component
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
# target branch of release. More info https://docs.github.com/en/rest/reference/repos#releases
# in case release is created from release branch then we need to checkout from given branch
# if @semantic-release/github is used to publish, the minimum version is 7.2.0 for proper working
ref: ${{ github.event.release.target_commitish }}
- name: Check package-lock version
uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master
id: lockversion
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "${{ steps.lockversion.outputs.version }}"
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install latest version of library in the web-component
run: VERSION=${{github.event.release.tag_name}} npm run install:reactcomp
working-directory: ./web-component
- name: Install dependencies
run: npm install
- name: Bundle
run: npm run bundle
working-directory: ./web-component
- name: Bump version in package.json
# There is no need to substract "v" from the tag as version script handles it
# When adding "bump:version" script in package.json, make sure no tags are added by default (--no-git-tag-version) as they are already added by release workflow
# When adding "bump:version" script in package.json, make sure --allow-same-version is set in case someone forgot and updated package.json manually and we want to avoide this action to fail and raise confusion
run: VERSION=${{github.event.release.tag_name}} npm run bump:webcomp:version
- name: Release web-component to NPM (@latest tag)
if: github.event.release.target_commitish == 'master'
uses: JS-DevTools/npm-publish@5a85faf05d2ade2d5b6682bfe5359915d5159c6c # using 2.2.1 version https://github.com/JS-DevTools/npm-publish/releases/tag/v2.2.1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./web-component/package.json
access: public
- name: Release web-component to NPM (feature branch tag)
if: github.event.release.target_commitish != 'master'
uses: JS-DevTools/npm-publish@5a85faf05d2ade2d5b6682bfe5359915d5159c6c # using 2.2.1 version https://github.com/JS-DevTools/npm-publish/releases/tag/v2.2.1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./web-component/package.json
access: public
tag: github.event.release.target_commitish
- if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel
name: Report workflow run status to Slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,action,workflow
text: 'Release of web component for AsyncAPI React failed'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
playground:
name: Release Playground
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
# target branch of release. More info https://docs.github.com/en/rest/reference/repos#releases
# in case release is created from release branch then we need to checkout from given branch
# if @semantic-release/github is used to publish, the minimum version is 7.2.0 for proper working
ref: ${{ github.event.release.target_commitish }}
- name: Check package-lock version
uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master
id: lockversion
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "${{ steps.lockversion.outputs.version }}"
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
working-directory: ./playground
- name: Deploy GH page
uses: JamesIves/github-pages-deploy-action@a1ea191d508feb8485aceba848389d49f80ca2dc # use v4.4.3 https://github.com/JamesIves/github-pages-deploy-action/releases/tag/v4.4.3
with:
token: ${{ secrets.GH_TOKEN }}
branch: gh-pages
folder: playground/out
git-config-name: asyncapi-bot
git-config-email: [email protected]
- if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel
name: Report workflow run status to Slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,action,workflow
text: 'Release of playground for AsyncAPI React failed'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}