-
Notifications
You must be signed in to change notification settings - Fork 12
125 lines (104 loc) · 4.61 KB
/
compile-and-publish.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
name: Publish packages
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'lerna.json'
permissions:
id-token: write
contents: read
jobs:
publish-web:
name: Publish @cdssnc/gcds-components
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: "@cdssnc/gcds-components"
package: "./packages/web"
dist: "./packages/web"
steps:
- name: Git Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version: 18
- name: Install ${{ matrix.name }}
run: npm install
- name: Build ${{ matrix.name }}
run: npm run build
- name: Publish ${{ matrix.name }}
uses: JS-DevTools/npm-publish@e06fe3ef65499b38eb12224f2a60979f6d797330
id: publish
with:
token: ${{ secrets.NPM_TOKEN }}
package: ${{ matrix.dist }}
- name: Sleep for 60 seconds to give more time for NPM to complete publishing before proceeding to publish the rest
run: sleep 60
- name: Report deployment to Sentinel
if: steps.publish.outputs.id != ''
uses: cds-snc/sentinel-forward-data-action@main
with:
input_data: '{"product": "design-system", "sha": "${{ github.sha }}", "version": "${{steps.publish.outputs.id}}", "repository": "${{ github.repository }}", "environment": "production", "status": "${{ job.status }}"}'
log_type: CDS_Product_Deployment_Data
log_analytics_workspace_id: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
log_analytics_workspace_key: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}
- name: Slack notify on failure
if: failure()
run: |
json='{"blocks":[{"type":"section","text":{"type":"mrkdwn","text":":red: Publish ${{ matrix.name }} failed: <https://github.com/cds-snc/gcds-components/actions/workflows/compile-and-publish.yml|Publish packages>"}}]}'
curl -X POST -H 'Content-type: application/json' --data "$json" ${{ secrets.SLACK_WEBHOOK_OPS }}
publish-react-angular-vue-ssr:
name: Publish @cdssnc/gcds-components-react, @cdssnc/gcds-components-angular, @cdssnc/gcds-components-vue, @cdssnc/gcds-components-react-ssr
needs: publish-web
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: "@cdssnc/gcds-components-react"
package: "./packages/react"
dist: "./packages/react"
- name: "@cdssnc/gcds-components-angular"
package: "./packages/angular"
dist: "./packages/angular/dist"
- name: "@cdssnc/gcds-components-vue"
package: "./packages/vue"
dist: "./packages/vue"
- name: "@cdssnc/gcds-components-react-ssr"
package: "./packages/react-ssr"
dist: "./packages/react-ssr"
steps:
- name: Git Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version: 18
- name: Install monorepo (web, react, angular, vue)
run: npm install
- name: Build gcds-components (web, react, angular, vue)
run: npm run build
- name: Publish ${{ matrix.name }}
uses: JS-DevTools/npm-publish@e06fe3ef65499b38eb12224f2a60979f6d797330
id: publish
with:
token: ${{ secrets.NPM_TOKEN }}
package: ${{ matrix.dist }}
- name: Report deployment to Sentinel
if: steps.publish.outputs.id != ''
uses: cds-snc/sentinel-forward-data-action@main
with:
input_data: '{"product": "design-system", "sha": "${{ github.sha }}", "version": "${{steps.publish.outputs.id}}", "repository": "${{ github.repository }}", "environment": "production", "status": "${{ job.status }}"}'
log_type: CDS_Product_Deployment_Data
log_analytics_workspace_id: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
log_analytics_workspace_key: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}
- name: Slack notify on failure
if: failure()
run: |
json='{"blocks":[{"type":"section","text":{"type":"mrkdwn","text":":red: Publish ${{ matrix.name }} failed: <https://github.com/cds-snc/gcds-components/actions/workflows/compile-and-publish.yml|Publish packages>"}}]}'
curl -X POST -H 'Content-type: application/json' --data "$json" ${{ secrets.SLACK_WEBHOOK_OPS }}