Skip to content

Commit 85ec7ed

Browse files
committed
ci: deploy to s3
1 parent da1b4ff commit 85ec7ed

File tree

1 file changed

+66
-37
lines changed

1 file changed

+66
-37
lines changed

.github/workflows/cd.yml

Lines changed: 66 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,75 @@ name: Deploy Website
33
on:
44
push:
55
branches:
6-
- main
7-
- '*.*'
6+
- main
7+
- '*.*'
88

99
jobs:
1010
deploy:
1111
runs-on: ubuntu-latest
1212
steps:
13+
- name: Checkout the website
14+
uses: actions/checkout@v3
15+
with:
16+
repository: api-platform/website
17+
ref: main
18+
19+
- name: Get yarn cache directory path
20+
id: yarn-cache-dir-path
21+
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
22+
23+
- uses: actions/cache@v3
24+
id: yarn-cache
25+
with:
26+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
27+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
28+
restore-keys: |
29+
${{ runner.os }}-yarn-
30+
31+
32+
- name: Setup Hugo
33+
uses: peaceiris/actions-hugo@v2
34+
with:
35+
hugo-version: '0.119.0'
36+
extended: true
37+
38+
- name: Install php
39+
uses: shivammathur/setup-php@v2
40+
with:
41+
php-version: '8.2'
42+
tools: phive
43+
44+
- name: Auth gcloud
45+
uses: google-github-actions/auth@v1
46+
with:
47+
credentials_json: ${{ secrets.BUCKET_CREDS }}
48+
49+
- name: 'Set up Cloud SDK'
50+
uses: 'google-github-actions/setup-gcloud@v1'
51+
52+
- name: Compute documentation
53+
run: |
54+
git clone https://github.com/api-platform/docs-website
55+
cd docs-website
56+
npm install
57+
# fetches api-platform/docs
58+
bash tools/get-docs.sh
59+
# fetches api-platform/core for reference and guides
60+
bash tools/get-core-docs.sh
61+
# builds the config/_default/menu.toml according to the outline.yaml from api-platform/docs
62+
node tools/menu.mjs
63+
# build our tailwind theme
64+
hugo --minify
65+
gsutil -q -m rsync -d -r ./public gs://api-platform-website-v3/
66+
# This need to move to website
67+
# env:
68+
# GITHUB_KEY: ${{ secrets.CONTRIBUTORS_GITHUB_TOKEN }}
69+
# NODE_OPTIONS: --openssl-legacy-provider
70+
71+
# - name: Deploy
72+
# uses: peaceiris/actions-gh-pages@v3
73+
# with:
74+
# github_token: ${{ secrets.GITHUB_TOKEN }}
75+
# publish_dir: ./public
76+
# cname: api-platform.com
1377

14-
- name: Checkout the website
15-
uses: actions/checkout@v2
16-
with:
17-
repository: api-platform/website
18-
ref: main
19-
20-
- name: Get yarn cache directory path
21-
id: yarn-cache-dir-path
22-
run: echo "::set-output name=dir::$(yarn cache dir)"
23-
24-
- uses: actions/cache@v2
25-
id: yarn-cache
26-
with:
27-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
28-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
29-
restore-keys: |
30-
${{ runner.os }}-yarn-
31-
32-
- name: Install deps
33-
run: yarn install
34-
35-
- name: Retrieve docs
36-
run: bin/retrieve-documentation
37-
38-
- name: Build website
39-
env:
40-
GITHUB_KEY: ${{ secrets.CONTRIBUTORS_GITHUB_TOKEN }}
41-
run: yarn gatsby build
42-
43-
- name: Deploy
44-
uses: peaceiris/actions-gh-pages@v3
45-
with:
46-
github_token: ${{ secrets.GITHUB_TOKEN }}
47-
publish_dir: ./public
48-
cname: api-platform.com

0 commit comments

Comments
 (0)