8000 Split CI build, restore Cloudflare purge for datasheets by Serjlee · Pull Request #2153 · arduino/docs-content · GitHub
[go: up one dir, main page]

Skip to content

Split CI build, restore Cloudflare purge for datasheets #2153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move datasheets rendering to own action file
  • Loading branch information
Serjlee committed Sep 9, 2024
commit 94a7be9efa9e688e988160f950c528dcda9b6ce7
3 changes: 0 additions & 3 deletions .github/actions/cloudflare-upload/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ inputs:
runs:
using: composite
steps:

- name: Find PR Preview Comment
if: github.event_name == 'pull_request'
uses: peter-evans/find-comment@v1
Expand Down Expand Up @@ -67,7 +66,6 @@ runs:
🚀 Preview this PR: ${{ steps.deploy-cloudflare.outputs.url }}
📍 Commit SHA: ${{ github.sha }}


- name: Update PR Preview Comment
if: github.event_name == 'pull_request' && steps.deploy-preview-comment.outputs.comment-id != 0
uses: peter-evans/create-or-update-comment@v1.4.5
Expand All @@ -78,4 +76,3 @@ runs:
### ${{ inputs.project-name }}
🚀 Preview this PR: ${{ steps.deploy-cloudflare.outputs.url }}
📍 Commit SHA: ${{ github.sha }}

48 changes: 48 additions & 0 deletions .github/actions/generate-datasheets/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Generate Datasheets"
description: "Generate product datasheets from markdown files"
inputs:
datasheets-path:
description: "The datasheets path"
required: true
default: static/resources/datasheets
artifact-name:
description: "The name of the output artifact"
required: true

runs:
using: composite
steps:
- uses: actions/cache@v4
id: cache
with:
path: ${{ inputs.datasheets-path }}
key: ${{ runner.os }}-datasheets-${{ hashFiles('**/*datasheet.md') }}

- uses: actions/checkout@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
fetch-depth: 1

- uses: actions/setup-node@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
node-version: 18
cache: "npm"
cache-dependency-path: "package-lock.json"

- name: Render Datasheets
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd ${GITHUB_WORKSPACE}/scripts/datasheet-rendering
./render-datasheets.sh
cd $GITHUB_WORKSPACE
mkdir -p ${{ inputs.datasheets-path }}
find ./content/hardware -type f -name "*-datasheet.pdf" -exec cp {} ./${{ inputs.datasheets-path }}/ \;
shell: bash

- name: Export artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact-name }}
path: ${{ inputs.datasheets-path }}
retention-days: 1 # Only needed to pass it to the next job
37 changes: 4 additions & 33 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,10 @@ jobs:
name: Render Datasheets
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v4
id: cache
- uses: ./.github/actions/generated-datasheets
with:
path: static/resources/datasheets
key: ${{ runner.os }}-datasheets-${{ hashFiles('**/*datasheet.md') }}

- uses: actions/checkout@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
fetch-depth: 1

- uses: actions/setup-node@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
node-version: 18
cache: "npm"
cache-dependency-path: "package-lock.json"

- name: Render Datasheets
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd ${GITHUB_WORKSPACE}/scripts/datasheet-rendering
./render-datasheets.sh
cd $GITHUB_WORKSPACE
mkdir -p static/resources/datasheets
find ./content/hardware -type f -name "*-datasheet.pdf" -exec cp {} ./static/resources/datasheets/ \;

- name: Export artifact
uses: actions/upload-artifact@v4
with:
name: datasheets
path: static/resources/datasheets
retention-days: 1 # Only needed to pass it to the next job
artifact-name: datasheets
datasheets-path: static/resources/datasheets

build:
name: Build and Deploy
Expand All @@ -79,7 +50,7 @@ jobs:
cache: "npm"
cache-dependency-path: "package-lock.json"

- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v4 # Retrieve the datasheets generated in the previous job
with:
name: datasheets

Expand Down
0