-
Notifications
You must be signed in to change notification settings - Fork 3
91 lines (81 loc) · 2.54 KB
/
02-deploy-gh-pages.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
---
name: Deploy to gh-pages
on:
workflow_call:
inputs:
release:
required: false
default: "false"
type: string
preRelease:
required: false
default: "false"
type: string
jobs:
deploy:
name: Deploy
runs-on: ubuntu-24.04 # Use Ubuntu 24.04 explicitly
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: ⬇ Checkout repo
uses: actions/checkout@v4
- name: 🔄 Init Cache
uses: ./.github/actions/npm-cache
- name: ⬇ Download build
uses: ./.github/actions/download-tar-artifact
with:
name: patternlab
path: out
- 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: 🔨 Build page
env:
RELEASE: ${{ inputs.release }}
PRE_RELEASE: ${{ inputs.preRelease }}
NAME: ${{ steps.extract.outputs.name }}
run: |
chmod +rx ./.github/scripts/build-gh-page.sh
./.github/scripts/build-gh-page.sh
- name: 🥅 Deploy to GH-Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
- name: 🖨️ Print gh-pages url
env:
RELEASE: ${{ inputs.release }}
PRE_RELEASE: ${{ inputs.preRelease }}
NAME: ${{ steps.extract.outputs.name }}
run: |
if [[ $RELEASE == "true" ]];
then
export URL=https://db-ui.github.io/base
elif [[ $PRE_RELEASE == "true" ]];
then
export URL=https://db-ui.github.io/base/version/${NAME}
else
export URL=https://db-ui.github.io/base/review/${NAME}
fi
echo "URL: $URL"
echo "### GH-Pages URL :rocket: <br> <br> $URL" >> $GITHUB_STEP_SUMMARY
- name: 💀 Killing me softly
uses: ./.github/actions/cancel-workflow
if: failure()
with:
token: ${{ secrets.GITHUB_TOKEN }}