more links #178
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: Build | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
deploy: | |
name: Build website and push to S3 bucket | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
# Cache to shorten build times and decrease load on servers | |
# Don't have to install/fetch Gems/pips on every build | |
# https://docs.github.com/en/actions/advanced-guides/caching-dependencies-to-speed-up-workflows | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('Gemfile.lock') }} | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools six wheel | |
python -m pip install -r requirements.txt | |
# Use ruby/setup-ruby to cache Gems instead of manual process | |
# https://docs.knapsackpro.com/2021/how-to-load-ruby-gems-from-cache-on-github-actions | |
# https://www.jessesquires.com/blog/2021/08/23/caching-bundler-on-github-actions/ | |
- name: Ruby setup | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.1 | |
# runs 'bundle install' and caches installed gems automatically | |
bundler-cache: true | |
- name: Jekyll Build | |
run: | | |
python3 notebook_to_markdown.py | |
# Generate intermediate files from Jekyll (use additional publish configs) | |
bundle exec jekyll build --config _config.yml,_config-publish.yml | |
# Minify/compress resources using https://github.com/divriots/jampack | |
npx -y @divriots/jampack ./_site/ --onlycomp | |
# Write current git revision to file for tracking | |
git rev-parse HEAD > ./_site/revision | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Deploy release web files to S3 bucket for static hosting | |
run: aws s3 sync ./_site s3://john-gentile.com --delete | |