-
Notifications
You must be signed in to change notification settings - Fork 7
57 lines (54 loc) · 1.85 KB
/
publish-pr-preview.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
name: Build PR preview
on:
pull_request:
# To manage 'surge-preview' action teardown, add default event types + closed event type
types: [opened, synchronize, reopened, closed]
branches:
- master
paths:
- 'gulpfile.js'
- 'package.json'
- 'package-lock.json'
- 'gulp.d/**/*'
- 'src/**/*'
- 'preview-src/**/*'
- '.github/actions/build-setup/**/*'
- '.github/workflows/publish-pr-preview.yml'
permissions:
# surge-preview creates or updates PR comments about the deployment status
pull-requests: write
jobs:
build_preview:
runs-on: ubuntu-22.04
steps:
- uses: bonitasoft/actions/packages/surge-preview-tools@v3
id: surge-preview-tools
with:
surge-token: ${{ secrets.SURGE_TOKEN_DOC }}
- name: Checkout
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'
run: npm run preview:build
- name: Upload artifact
if: github.event.action != 'closed' # Always upload to be able to test it locally
uses: actions/upload-artifact@v4
with:
name: bonita-theme-preview-pr-${{github.event.pull_request.number}}-${{github.sha}}
path: public
- name: Publish preview
uses: afc163/surge-preview@v1
if: steps.surge-preview-tools.outputs.can-run-surge-command == 'true'
env:
BONITA_THEME_URL: ${{ steps.surge-preview-tools.outputs.preview-url }}
with:
surge_token: ${{ secrets.SURGE_TOKEN_DOC }}
github_token: ${{ secrets.GITHUB_TOKEN }}
dist: public
failOnError: true
teardown: 'true'
build: echo "site already built"