Skip to content

chore: GCDS Components Release 0.23.0 (#601) #180

chore: GCDS Components Release 0.23.0 (#601)

chore: GCDS Components Release 0.23.0 (#601) #180

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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Node
uses: actions/setup-node@26961cf329f22f6837d5f54c3efd76b480300ace
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@76c32bca7fbfb29fc528466ca3ae27ae9f35d42b
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:
name: Publish @cdssnc/gcds-components-react, @cdssnc/gcds-components-angular, @cdssnc/gcds-components-vue
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"
steps:
- name: Git Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Node
uses: actions/setup-node@26961cf329f22f6837d5f54c3efd76b480300ace
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@76c32bca7fbfb29fc528466ca3ae27ae9f35d42b
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 }}
publish-react-ssr:
name: Publish React SSR
needs: publish-web
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: "@cdssnc/gcds-components-react-ssr"
package: "./packages/react-ssr"
dist: "./packages/react-ssr"
steps:
- name: Git Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Node
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: 18
- name: Install monorepo (react-ssr)
run: npm install
- name: Build gcds-components (react-ssr)
run: npm run build
- name: Publish ${{ matrix.name }}
uses: JS-DevTools/npm-publish@76c32bca7fbfb29fc528466ca3ae27ae9f35d42b
id: publish
with:
token: ${{ secrets.NPM_TOKEN }}
package: ${{ matrix.dist }}
tag: canary
- 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 }}