Skip to content

Ci/optimize site deployment #336

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 4 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion .github/workflows/cron-check-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ name: Cron job to check links
on:
schedule:
- cron: '0 2 * * 1'
workflow_dispatch: # Allow manual runs
# Allow manual runs from the Actions tab
workflow_dispatch:

jobs:
cron-check-links:
if: github.repository_owner == 'espressif'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/cron-deploy-hugo-site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Workflow for building and deploying a Hugo site to AWS S3 Bucket
name: Deploy Hugo site to AWS S3 Bucket

on:
schedule:
- cron: '5 0 * * *'
# Allow manual runs from the Actions tab
workflow_dispatch:

# Set permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

# Default to bash
defaults:
run:
shell: bash

jobs:
build-and-deploy:
if: github.repository_owner == 'espressif'
runs-on: ubuntu-latest
steps:

- name: Install Hugo CLI
env:
HUGO_VERSION: 0.135.0
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb

- name: Check out repo
uses: actions/checkout@v4
with:
submodules: recursive

- name: Build website with Hugo
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--gc \
--minify

- name: Copy files to AWS S3 with AWS CLI
uses: jakejarvis/s3-sync-action@master
with:
args: --follow-symlinks --delete --exclude "persist/*"
env:
AWS_S3_BUCKET: ${{ secrets.AWS_BUCKET_NAME }}
SOURCE_DIR: './public'
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

invalidate-cache:
needs: build-and-deploy
runs-on: ubuntu-latest
steps:

- name: Invalidate cloudfront cache
uses: chetan/invalidate-cloudfront-action@v2
env:
PATHS: "/*"
DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
2 changes: 1 addition & 1 deletion .github/workflows/deploy-hugo-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
push:
branches:
- main
# Add an option to run this workflow manually from the Actions tab
# Allow manual runs from the Actions tab
workflow_dispatch:

# Set permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
Expand Down
24 changes: 0 additions & 24 deletions content/pages/arduino/index.md

This file was deleted.

24 changes: 0 additions & 24 deletions content/pages/esp-idf/index.md

This file was deleted.

24 changes: 0 additions & 24 deletions content/pages/ides/index.md

This file was deleted.

24 changes: 0 additions & 24 deletions content/pages/nuttx/index.md

This file was deleted.

24 changes: 0 additions & 24 deletions content/pages/rust/index.md

This file was deleted.

24 changes: 0 additions & 24 deletions content/pages/zephyr/index.md

This file was deleted.