-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathaction.yml
More file actions
59 lines (58 loc) · 2.24 KB
/
action.yml
File metadata and controls
59 lines (58 loc) · 2.24 KB
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
name: 'Custom surge preview'
description: 'Simplify usage of surge-preview'
inputs:
artifact-name:
description: 'The name of the artifact that is uploaded when it is not possible to deploy to surge'
required: true
build-preview-command:
description: 'The command to build the preview'
required: true
build-preview-dist:
description: 'The dist folder deployed to surge.sh'
required: true
github-token:
description: 'A token with `pull-requests: write` to let the surge-preview action create comments on pull requests'
required: true
surge-token:
description: 'A surge token to manage the deployment'
required: true
runs:
using: 'composite'
steps:
- uses: bonitasoft/actions/packages/surge-preview-tools@v3
id: surge-preview-tools
with:
surge-token: ${{ inputs.surge-token }}
- uses: actions/checkout@v4
if: github.event.action != 'closed'
- name: Build Setup
uses: ./.github/actions/build-setup
if: github.event.action != 'closed'
- name: Build preview
if: github.event.action != 'closed'
shell: bash
run: ${{ inputs.build-preview-command }}
- name: List the size of the chunks in the demo
if: github.event.action != 'closed' && contains(inputs.build-preview-command, 'demo')
shell: bash
run: |
scripts/list-demo-lib-chunks.sh
echo "## Demo lib chunk sizes" >> "$GITHUB_STEP_SUMMARY"
scripts/list-demo-lib-chunks.sh --md-simple >> "$GITHUB_STEP_SUMMARY"
- name: Manage surge preview
if: steps.surge-preview-tools.outputs.can-run-surge-command == 'true'
uses: afc163/surge-preview@v1
with:
surge_token: ${{ inputs.surge-token }}
github_token: ${{ inputs.github-token }}
dist: ${{ inputs.build-preview-dist }}
failOnError: true
teardown: 'true'
build: echo 'already built!'
# Fallback when it is not possible to deploy to surge
- name: Upload artifact (preview not deployed)
if: github.event.action != 'closed' && steps.surge-preview-tools.outputs.can-run-surge-command == 'false'
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact-name }}-${{github.sha}}
path: ${{ inputs.build-preview-dist }}