Skip to content

Commit a78fe7e

Browse files
committed
Split up verify & publish steps
Now we can verify prs or commits to other branches without attempting a deploy
1 parent de754b8 commit a78fe7e

3 files changed

Lines changed: 66 additions & 2 deletions

File tree

.github/workflows/_build.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build Site
2+
3+
on:
4+
workflow_call:
5+
outputs:
6+
build-successful:
7+
description: "Whether the build succeeded"
8+
value: ${{ jobs.build.outputs.success }}
9+
10+
jobs:
11+
build:
12+
name: Build Documentation Site
13+
runs-on: ubuntu-latest
14+
outputs:
15+
success: ${{ steps.build.outcome == 'success' }}
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
20+
- name: Setup Ruby and install gems
21+
uses: ruby/setup-ruby@v1
22+
with:
23+
bundler-cache: true
24+
env:
25+
BUNDLE_CACHE_PATH: "vendor/cache"
26+
27+
- name: Build site
28+
id: build
29+
run: |
30+
bin/build
31+
32+
- name: Verify build artifacts exist
33+
run: |
34+
test -f build/index.html || (echo "build/index.html not found" && exit 1)
35+
test -f source/schema.json || (echo "source/schema.json not found" && exit 1)
36+
test -f source/includes/resources.md || (echo "source/includes/resources.md not found" && exit 1)
37+
echo "All required build artifacts present"

.github/workflows/publish.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,47 @@
11
name: Publish to developers.betternow.org
2-
on: [push]
2+
on:
3+
push:
4+
branches:
5+
- master
6+
37
permissions:
48
id-token: write
59
contents: read
610

711
jobs:
812
build:
9-
name: Build and Deploy
13+
name: Build Documentation Site
14+
uses: ./.github/workflows/_build.yml
15+
16+
deploy:
17+
name: Deploy to S3
18+
needs: build
1019
runs-on: ubuntu-latest
20+
permissions:
21+
id-token: write
22+
contents: read
1123
steps:
1224
- name: Checkout
1325
uses: actions/checkout@v2
26+
1427
- name: Setup Ruby and install gems
1528
uses: ruby/setup-ruby@v1
1629
with:
1730
bundler-cache: true
1831
env:
1932
BUNDLE_CACHE_PATH: "vendor/cache"
33+
2034
- name: Build site
2135
run: |
2236
bin/build
37+
2338
- name: Configure AWS credentials
2439
uses: aws-actions/configure-aws-credentials@v1
2540
with:
2641
role-to-assume: arn:aws:iam::357932486739:role/developer-docs-deployer
2742
role-session-name: deploydeveloperdocs
2843
aws-region: eu-west-1
44+
2945
- name: Deploy the site
3046
run: |
3147
bin/deploy

.github/workflows/verify.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Verify Build
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
8+
jobs:
9+
verify:
10+
name: Verify Documentation Build
11+
uses: ./.github/workflows/_build.yml

0 commit comments

Comments
 (0)