-
Notifications
You must be signed in to change notification settings - Fork 9
105 lines (93 loc) · 2.93 KB
/
01-build-patternhub.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
---
name: Build Patternhub
on:
workflow_call:
inputs:
release:
required: false
default: "false"
type: string
preRelease:
required: false
default: "false"
type: string
outputs:
path:
description: "Base path for patternhub"
value: ${{ jobs.build-patternhub.outputs.path }}
jobs:
build-patternhub:
name: Build Patternhub
runs-on: ubuntu-latest
outputs:
path: ${{ steps.build.outputs.path }}
steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4
- name: 🔄 Init Cache
uses: ./.github/actions/npm-cache
- name: ⏬ Download foundations build
uses: actions/download-artifact@v4
with:
name: db-ui-foundations-build
path: packages/foundations/build
- name: ⏬ Download output
uses: actions/download-artifact@v4
with:
name: db-ui-output
path: output
- name: ⏬ Download components build
uses: actions/download-artifact@v4
with:
name: db-ui-components-build
path: packages/components/build
- name: ↔ Extract branch name
uses: ./.github/actions/extract-branch
id: extract_branch
- name: ↔ Extract branch/tag name
shell: bash
env:
RELEASE: ${{ inputs.release }}
PRE_RELEASE: ${{ inputs.preRelease }}
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch-name }}
run: |
if [[ $RELEASE == "true" || $PRE_RELEASE == "true" ]]
then
echo "name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
else
echo "name=${BRANCH_NAME}" >> $GITHUB_OUTPUT
fi
id: extract
- name: 🛤 Get base path
uses: actions/github-script@v7
env:
NAME: ${{ steps.extract.outputs.name }}
RELEASE: ${{ inputs.release }}
PRE_RELEASE: ${{ inputs.preRelease }}
id: base-path
with:
result-encoding: string
script: |
var path = 'review';
if(process.env.RELEASE === "true" || process.env.PRE_RELEASE === "true") {
path = 'version'
}
return `/${context?.payload?.repository?.name}/${path}/${process.env.NAME}`
- name: 🔨 Build Patternhub
id: build
env:
NEXT_PUBLIC_BASE_PATH: ${{ steps.base-path.outputs.result }}
run: |
npx --no tsx scripts/md-resolve-svg.ts
npm run build --workspace=patternhub
echo "path=${NEXT_PUBLIC_BASE_PATH}" >> $GITHUB_OUTPUT
- name: ⏫ Upload Patternhub
uses: actions/upload-artifact@v4
with:
name: db-ui-patternhub
path: build-showcases/patternhub
- name: 💀 Killing me softly
uses: ./.github/actions/cancel-workflow
if: failure()
with:
token: ${{ secrets.GITHUB_TOKEN }}