Skip to content

Commit 45e2f3b

Browse files
authored
Merge pull request #16 from vdice/ci/deploy-preview
ci(.github): add deploy preview workflow
2 parents 8ce8ac1 + 1a70e47 commit 45e2f3b

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/deploy-preview.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: deploy docs preview
2+
on:
3+
pull_request:
4+
branches: "main"
5+
types: ['opened', 'synchronize', 'reopened', 'closed']
6+
7+
jobs:
8+
deploy-preview:
9+
runs-on: ubuntu-24.04
10+
if: ${{ !github.event.pull_request.head.repo.fork }}
11+
name: Build and deploy
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Setup `spin`
16+
uses: fermyon/actions/spin/setup@v1
17+
with:
18+
github_token: ${{ secrets.GITHUB_TOKEN }}
19+
20+
- name: Install npm packages
21+
run: |
22+
npm ci
23+
npm ci --prefix ./spin-up-hub
24+
25+
- name: Build app
26+
run: |
27+
spin build
28+
29+
- name: build and deploy preview
30+
uses: fermyon/actions/spin/preview@v1
31+
env:
32+
# Create archive layers to consolidate the hundreds of static asset layers together
33+
SPIN_OCI_ARCHIVE_LAYERS: 1
34+
with:
35+
fermyon_token: ${{ secrets.FERMYON_CLOUD_TOKEN }}
36+
github_token: ${{ secrets.GITHUB_TOKEN }}
37+
undeploy: ${{ github.event.pull_request && github.event.action == 'closed' }}

0 commit comments

Comments
 (0)