Skip to content

Commit 623ec86

Browse files
committed
Deploy to docs-content
1 parent bc48318 commit 623ec86

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

.github/workflows/deploy-staging.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Deploy to docs-content.oniudra.cc
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- ghaction
8+
- PNX-5069-deploy-to-docs-content
9+
10+
concurrency:
11+
group: deploy-staging
12+
cancel-in-progress: true
13+
14+
permissions:
15+
id-token: write
16+
contents: read
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
environment: staging
22+
env:
23+
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
24+
APP_ENV: staging
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
- run: git log -1 --pretty=format:%aI content/learn/04.electronics/05.servo-motors/servo-motors.md
31+
- uses: actions/setup-node@v4
32+
with:
33+
node-version: 18
34+
cache: "npm"
35+
cache-dependency-path: "**/package-lock.json"
36+
37+
- name: Render Datasheets
38+
run: cd ${GITHUB_WORKSPACE}/scripts/datasheet-rendering;./render-datasheets.sh
39+
40+
- name: Copy Static Files
41+
run: |
42+
mkdir -p static/resources/datasheets static/resources/schematics static/resources/pinouts
43+
find ./content/hardware -type f -name "*-schematics.pdf" -exec cp {} ./static/resources/schematics/ \;
44+
find ./content/hardware -type f -name "*-datasheet.pdf" -exec cp {} ./static/resources/datasheets/ \;
45+
find ./content/hardware -type f -name "*-full-pinout.pdf" -exec cp {} ./static/resources/pinouts/ \;
46+
find ./content/hardware -type f -name "*-pinout.png" -exec cp {} ./static/resources/pinouts/ \;
47+
find ./content/hardware -type f -name "*-step.zip" -exec cp {} ./static/resources/models/ \;
48+
49+
- name: Gatsby main cache
50+
uses: actions/cache@v4
51+
id: gatsby-cache-folder
52+
with:
53+
path: .cache
54+
key: ${{ runner.os }}-cache-gatsby-${{ github.sha }}
55+
restore-keys: |
56+
${{ runner.os }}-cache-gatsby-
57+
58+
- name: Gatsby Public Folder
59+
uses: actions/cache@v4
60+
id: gatsby-public-folder
61+
with:
62+
path: public/
63+
key: ${{ runner.os }}-public-gatsby-${{ github.sha }}
64+
restore-keys: |
65+
${{ runner.os }}-public-gatsby-
66+
67+
- run: npm install
68+
- run: npm run build
69+
70+
deploy:
71+
needs: build
72+
uses: bcmi-labs/github-actions/.github/workflows/static-website-deploy.yml@static-website-deploy-v1
73+
with:
74+
third-level: docs-content # => docs-content.oniudra.cc (staging)
75+
environment: staging
76+
77+
#- name: Sync all cacheable assets
78+
# run: aws s3 sync --cache-control "public, max-age=31536000, immutable" --include "*.css" --include="*.js" --include="*.gif" --include="*.png" --include="*.svg" --exclude "*.html" --exclude="sw.js" --exclude="*.json" --delete public/ s3://${{ secrets.STAGING_BUCKET_NAME }}/
79+
80+
#- name: Sync all non-cacheable assets
81+
# # Don't cache any HTML or JSON file: they should always be up-to-dates
82+
# run: aws s3 sync --cache-control "public, max-age=0, must-revalidate" --include "*.html" --include="sw.js" --include="*.json" --include "*.css" --exclude="*.js" --exclude="*.gif" --exclude="*.png" --exclude="*.svg" --delete public/ s3://${{ secrets.STAGING_BUCKET_NAME }}/

0 commit comments

Comments
 (0)