Jekyll site CI #1023
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
name: Jekyll site CI | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: 0 10 * * * | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
check-repo-owner: | |
# This job is so the entire workflow will end successfully and give some | |
# output to explain why it hasn't run on a non-Adafruit fork. | |
runs-on: ubuntu-latest | |
steps: | |
- name: repository | |
env: | |
OWNER_IS_ADAFRUIT: ${{ startswith(github.repository, 'adafruit/') }} | |
run: | | |
echo "This workflow will only run if Adafruit is the repository owner." | |
echo "Repository owner is Adafruit: $OWNER_IS_ADAFRUIT" | |
build: | |
runs-on: ubuntu-latest | |
# Only run the build on Adafruit's repository. Forks won't have the secrets. | |
# Its necessary to do this here, since 'schedule' events cannot (currently) | |
# be limited (they run on all forks' default branches). | |
if: startswith(github.repository, 'adafruit/') | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Update Awesome CircuitPython | |
run: | | |
(cd awesome-circuitpython && git fetch origin main:main && git checkout main) | |
- name: Set up Python 3.x | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3' | |
bundler-cache: true | |
- name: Install Dependencies | |
run: | | |
gem install bundler:2.2.26 | |
bundle install --full-index | |
pip install python-frontmatter pillow python-dateutil | |
- name: Check feature names and other data | |
run: python3 tools/check-boards.py | |
- name: Check Image Dimensions | |
run: python3 tools/check-images.py | |
- name: Make Directory For Report Files | |
run: mkdir -p json | |
- name: Generate ESP32 Boards JSON | |
run: python3 tools/generate-board-info.py -o json/esp32_boards.json | |
- name: Check For Files | |
run: | | |
ls json | |
- name: Upload ESP32 Boards JSON To AWS S3 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp json/esp32_boards.json s3://adafruit-circuit-python/esp32_boards.json --no-progress --region us-east-1" | |
- name: Build site with jekyll | |
run: | | |
bundle exec jekyll build -d build | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./build | |
cname: circuitpython.org | |
user_name: ${{ secrets.ADABOT_GITHUB_USER }} | |
user_email: ${{ secrets.ADABOT_GITHUB_EMAIL }} | |
if: github.event_name != 'pull_request' |