Skip to content

Commit 94a7be9

Browse files
committed
Move datasheets rendering to own action file
1 parent 9c38d5f commit 94a7be9

File tree

3 files changed

+52
-36
lines changed

3 files changed

+52
-36
lines changed

.github/actions/cloudflare-upload/action.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ inputs:
2020
runs:
2121
using: composite
2222
steps:
23-
2423
- name: Find PR Preview Comment
2524
if: github.event_name == 'pull_request'
2625
uses: peter-evans/find-comment@v1
@@ -67,7 +66,6 @@ runs:
6766
🚀 Preview this PR: ${{ steps.deploy-cloudflare.outputs.url }}
6867
📍 Commit SHA: ${{ github.sha }}
6968
70-
7169
- name: Update PR Preview Comment
7270
if: github.event_name == 'pull_request' && steps.deploy-preview-comment.outputs.comment-id != 0
7371
uses: peter-evans/[email protected]
@@ -78,4 +76,3 @@ runs:
7876
### ${{ inputs.project-name }}
7977
🚀 Preview this PR: ${{ steps.deploy-cloudflare.outputs.url }}
8078
📍 Commit SHA: ${{ github.sha }}
81-
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "Generate Datasheets"
2+
description: "Generate product datasheets from markdown files"
3+
inputs:
4+
datasheets-path:
5+
description: "The datasheets path"
6+
required: true
7+
default: static/resources/datasheets
8+
artifact-name:
9+
description: "The name of the output artifact"
10+
required: true
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- uses: actions/cache@v4
16+
id: cache
17+
with:
18+
path: ${{ inputs.datasheets-path }}
19+
key: ${{ runner.os }}-datasheets-${{ hashFiles('**/*datasheet.md') }}
20+
21+
- uses: actions/checkout@v4
22+
if: steps.cache.outputs.cache-hit != 'true'
23+
with:
24+
fetch-depth: 1
25+
26+
- uses: actions/setup-node@v4
27+
if: steps.cache.outputs.cache-hit != 'true'
28+
with:
29+
node-version: 18
30+
cache: "npm"
31+
cache-dependency-path: "package-lock.json"
32+
33+
- name: Render Datasheets
34+
if: steps.cache.outputs.cache-hit != 'true'
35+
run: |
36+
cd ${GITHUB_WORKSPACE}/scripts/datasheet-rendering
37+
./render-datasheets.sh
38+
cd $GITHUB_WORKSPACE
39+
mkdir -p ${{ inputs.datasheets-path }}
40+
find ./content/hardware -type f -name "*-datasheet.pdf" -exec cp {} ./${{ inputs.datasheets-path }}/ \;
41+
shell: bash
42+
43+
- name: Export artifact
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: ${{ inputs.artifact-name }}
47+
path: ${{ inputs.datasheets-path }}
48+
retention-days: 1 # Only needed to pass it to the next job

.github/workflows/deploy-staging.yml

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,39 +22,10 @@ jobs:
2222
name: Render Datasheets
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: actions/cache@v4
26-
id: cache
25+
- uses: ./.github/actions/generated-datasheets
2726
with:
28-
path: static/resources/datasheets
29-
key: ${{ runner.os }}-datasheets-${{ hashFiles('**/*datasheet.md') }}
30-
31-
- uses: actions/checkout@v4
32-
if: steps.cache.outputs.cache-hit != 'true'
33-
with:
34-
fetch-depth: 1
35-
36-
- uses: actions/setup-node@v4
37-
if: steps.cache.outputs.cache-hit != 'true'
38-
with:
39-
node-version: 18
40-
cache: "npm"
41-
cache-dependency-path: "package-lock.json"
42-
43-
- name: Render Datasheets
44-
if: steps.cache.outputs.cache-hit != 'true'
45-
run: |
46-
cd ${GITHUB_WORKSPACE}/scripts/datasheet-rendering
47-
./render-datasheets.sh
48-
cd $GITHUB_WORKSPACE
49-
mkdir -p static/resources/datasheets
50-
find ./content/hardware -type f -name "*-datasheet.pdf" -exec cp {} ./static/resources/datasheets/ \;
51-
52-
- name: Export artifact
53-
uses: actions/upload-artifact@v4
54-
with:
55-
name: datasheets
56-
path: static/resources/datasheets
57-
retention-days: 1 # Only needed to pass it to the next job
27+
artifact-name: datasheets
28+
datasheets-path: static/resources/datasheets
5829

5930
build:
6031
name: Build and Deploy
@@ -79,7 +50,7 @@ jobs:
7950
cache: "npm"
8051
cache-dependency-path: "package-lock.json"
8152

82-
- uses: actions/download-artifact@v4
53+
- uses: actions/download-artifact@v4 # Retrieve the datasheets generated in the previous job
8354
with:
8455
name: datasheets
8556

0 commit comments

Comments
 (0)