circuitpython-org/.github/workflows/build.yml
Melissa LeBlanc-Williams d448a81007 Fix dependency issue
2021-01-25 08:30:30 -08:00

56 lines
1.8 KiB
YAML

name: Jekyll site CI
on:
push:
branches:
- master
schedule:
- cron: 0 10 * * *
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@v1
with:
submodules: true
- uses: actions/setup-ruby@v1
with:
ruby-version: '2.x'
- name: Install Dependencies
run: |
gem install bundler:1.17.3
bundle install --full-index
- name: Build site with jekyll
run: |
bundle exec jekyll build -d build
- name: Commit and Push to gh-pages
run: |
# https://github.com/helaili/jekyll-action/blob/master/entrypoint.sh#L49
cd build
touch .nojekyll
git init
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add .
git commit -m 'jekyll build from Action'
git push --force https://${ADABOT_PAT}@github.com/${GITHUB_REPOSITORY}.git HEAD:gh-pages
rm -fr .git
cd ..
env:
ADABOT_PAT: ${{ secrets.ADABOT_PAT }}