Skip to content

Commit b310d82

Browse files
committed
fixup! Deploy to docs-content
1 parent 1fa48af commit b310d82

File tree

2 files changed

+81
-1
lines changed

2 files changed

+81
-1
lines changed
+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Deploy to docs-content.arduino.cc
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
- PNX-5069-deploy-to-docs-content
9+
10+
concurrency:
11+
group: deploy-production
12+
cancel-in-progress: true
13+
14+
permissions:
15+
id-token: write
16+
contents: read
17+
18+
jobs:
19+
build:
20+
if: "github.repository == 'arduino/docs-content'"
21+
runs-on: ubuntu-latest
22+
environment: production
23+
env:
24+
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
25+
APP_ENV: prod
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
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+
- name: Configure AWS credentials from Production account
71+
uses: aws-actions/configure-aws-credentials@v4
72+
with:
73+
role-to-assume: ${{ secrets.PRODUCTION_IAM_ROLE }}
74+
aws-region: us-east-1
75+
76+
- name: Sync all cacheable assets
77+
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.PRODUCTION_BUCKET_NAME }}/
78+
79+
- name: Sync all non-cacheable assets
80+
# Don't cache any HTML or JSON file: they should always be up-to-dates
81+
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.PRODUCTION_BUCKET_NAME }}/

.github/workflows/deploy-staging.yml

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
push:
66
branches:
77
- ghaction
8-
- PNX-5069-deploy-to-docs-content
98

109
concurrency:
1110
group: deploy-staging

0 commit comments

Comments
 (0)