-
-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split CI build, restore Cloudflare purge for datasheets (#2153)
* Split CI build * Skip everything on cache hit * Fix output path * Move datasheets rendering to own action file * Set name * Add debug step for datasheets * Update production workflow, too * Fix APP_ENV * Checkout is inevitable * Fix purge * Explicit checkout * Typo * Remove restore-key * Use correct folder * 2.0.18-2-alpha.1 * 2.0.18-2 * Fail on purge fail, debug prefix and zone * Remove debug log --------- Co-authored-by: Matteo Marsala <[email protected]>
- Loading branch information
Showing
8 changed files
with
210 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Disk cleanup | ||
description: "Cleanup disk space" | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Free up disk space | ||
shell: bash | ||
run: | | ||
echo "Disk space before cleanup..." | ||
df -h / | ||
echo "Removing unnecessary files to free up disk space..." | ||
# https://github.com/actions/runner-images/issues/2840#issuecomment-2272410832 | ||
sudo rm -rf \ | ||
/opt/hostedtoolcache \ | ||
/opt/google/chrome \ | ||
/opt/microsoft/msedge \ | ||
/opt/microsoft/powershell \ | ||
/opt/pipx \ | ||
/usr/lib/mono \ | ||
/usr/local/julia* \ | ||
/usr/local/lib/android \ | ||
/usr/local/lib/node_modules \ | ||
/usr/local/share/chromium \ | ||
/usr/local/share/powershell \ | ||
/usr/share/dotnet \ | ||
/usr/share/swift | ||
echo "Disk space after cleanup..." | ||
df -h / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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/[email protected] | ||
|
@@ -78,4 +76,3 @@ runs: | |
### ${{ inputs.project-name }} | ||
🚀 Preview this PR: ${{ steps.deploy-cloudflare.outputs.url }} | ||
📍 Commit SHA: ${{ github.sha }} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Sync assets on S3 | ||
description: "Sync Docs assets on S3" | ||
inputs: | ||
role-to-assume: | ||
description: "The IAM role to assume" | ||
required: true | ||
bucket-name: | ||
description: "The name of the S3 bucket to sync assets to" | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Configure AWS credentials from Staging account | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ inputs.role-to-assume }} | ||
aws-region: us-east-1 | ||
|
||
- name: Sync all cacheable assets | ||
shell: bash | ||
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" --exclude="*.pdf" --delete public/ s3://${{ inputs.bucket-name }}/ | ||
|
||
- name: Sync all non-cacheable assets | ||
shell: bash | ||
# Don't cache any HTML or JSON file: they should always be up-to-dates | ||
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" --exclude="*.pdf" --delete public/ s3://${{ inputs.bucket-name }}/ | ||
|
||
- name: Sync PDF | ||
shell: bash | ||
run: aws s3 sync --cache-control "public, max-age=86400, must-revalidate" --include "*.pdf" --exclude="*.js" --exclude="*.gif" --exclude="*.png" --exclude="*.svg" --exclude="*.css" --exclude="*.html" --exclude="*.json" --exclude="sw.json" --delete public/ s3://${{ inputs.bucket-name }}/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.