Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 88f21f7

Browse files
Merge pull request #2005 from arduino/PNX-5069-deploy-to-docs-content
[PNX-5069] Deploy to docs-content
2 parents 53fb961 + b9e6c27 commit 88f21f7

File tree

2 files changed

+160
-0
lines changed

2 files changed

+160
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Deploy to docs-content.arduino.cc
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: deploy-production
11+
cancel-in-progress: true
12+
13+
permissions:
14+
id-token: write
15+
contents: read
16+
17+
jobs:
18+
build:
19+
if: "github.repository == 'arduino/docs-content'"
20+
runs-on: ubuntu-latest
21+
environment: production
22+
env:
23+
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
24+
APP_ENV: prod
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
- uses: actions/setup-node@v4
31+
with:
32+
node-version: 18
33+
cache: "npm"
34+
cache-dependency-path: "**/package-lock.json"
35+
36+
- name: Render Datasheets
37+
run: cd ${GITHUB_WORKSPACE}/scripts/datasheet-rendering;./render-datasheets.sh
38+
39+
- name: Copy Static Files
40+
run: |
41+
mkdir -p static/resources/datasheets static/resources/schematics static/resources/pinouts
42+
find ./content/hardware -type f -name "*-schematics.pdf" -exec cp {} ./static/resources/schematics/ \;
43+
find ./content/hardware -type f -name "*-datasheet.pdf" -exec cp {} ./static/resources/datasheets/ \;
44+
find ./content/hardware -type f -name "*-full-pinout.pdf" -exec cp {} ./static/resources/pinouts/ \;
45+
find ./content/hardware -type f -name "*-pinout.png" -exec cp {} ./static/resources/pinouts/ \;
46+
find ./content/hardware -type f -name "*-step.zip" -exec cp {} ./static/resources/models/ \;
47+
48+
- name: Gatsby main cache
49+
uses: actions/cache@v4
50+
id: gatsby-cache-folder
51+
with:
52+
path: .cache
53+
key: ${{ runner.os }}-cache-gatsby-${{ github.sha }}
54+
restore-keys: |
55+
${{ runner.os }}-cache-gatsby-
56+
57+
- name: Gatsby Public Folder
58+
uses: actions/cache@v4
59+
id: gatsby-public-folder
60+
with:
61+
path: public/
62+
key: ${{ runner.os }}-public-gatsby-${{ github.sha }}
63+
restore-keys: |
64+
${{ runner.os }}-public-gatsby-
65+
66+
- run: npm install
67+
- run: npm run build
68+
69+
- name: Configure AWS credentials from Production account
70+
uses: aws-actions/configure-aws-credentials@v4
71+
with:
72+
role-to-assume: ${{ secrets.PRODUCTION_IAM_ROLE }}
73+
aws-region: us-east-1
74+
75+
- name: Sync all cacheable assets
76+
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 }}/
77+
78+
- name: Sync all non-cacheable assets
79+
# Don't cache any HTML or JSON file: they should always be up-to-dates
80+
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‎

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

AltStyle によって変換されたページ (->オリジナル) /