-
Notifications
You must be signed in to change notification settings - Fork 14
91 lines (77 loc) · 2.85 KB
/
release-documentation.yaml
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
name: Release Documentation
on:
push:
branches:
- main
- release/v*
paths:
- 'packages/documentation/package.json'
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
detect-version-change:
name: Detect Version Change
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.check.outputs.changed }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Detect Version Change
id: check
uses: EndBug/version-check@v2
with:
file-name: ./packages/documentation/package.json
diff-search: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create Summary
id: summary
uses: actions/github-script@v7
with:
script: |
return `# Version Change Detection
A version change has ${${{ steps.check.outputs.changed == 'true' }} ? 'been' : 'NOT been'} detected.
`
- name: Output Summary
run: echo -e ${{ steps.summary.outputs.result }} >> $GITHUB_STEP_SUMMARY
release:
name: Release Documentation
runs-on: ubuntu-latest
needs: detect-version-change
if: needs.detect-version-change.outputs.changed == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm & node
uses: ./.github/actions/setup-pnpm
- name: Install documentation & dependencies
run: pnpm --filter "design-system-documentation..." install
- name: Build documentation & dependencies
run: pnpm --filter "design-system-documentation..." build
- name: Setup netlify-cli
uses: ./.github/actions/setup-netlify-cli
- name: Get Netlify Config
id: netlify-config
uses: actions/github-script@v7
with:
script: |
const fs = require('fs')
return JSON.parse(fs.readFileSync('./packages/documentation/netlify.config.json', 'utf8'))
- name: Publish documentation to netlify
id: deploy
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ fromJSON(steps.netlify-config.outputs.result).siteId }}
run: |
echo "site-url=https://${{ fromJSON(steps.netlify-config.outputs.result).siteUrl }}" >> $GITHUB_OUTPUT
netlify deploy --filter @swisspost/design-system-documentation --build false --dir packages/documentation/storybook-static --prod
- name: Create Summary
id: summary
uses: actions/github-script@v7
with:
script: |
return `# Deployed Documentation
- SiteId: <code>${{ fromJSON(steps.netlify-config.outputs.result).siteId }}</code>
- SiteUrl: ${{ steps.deploy.outputs.site-url }}
`
- name: Output Summary
run: echo -e ${{ steps.summary.outputs.result }} >> $GITHUB_STEP_SUMMARY