46 lines
1.4 KiB
YAML
46 lines
1.4 KiB
YAML
name: Build and Publish Website
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
release:
|
|
types: [published]
|
|
check_suite:
|
|
types: [rerequested]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-18.04
|
|
container: debian:buster
|
|
|
|
steps:
|
|
- name: install dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get --no-install-recommends -y install admesh git imagemagick ruby-bundler jekyll make openscad python3 python3-yaml xauth xvfb build-essential ruby-dev
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
- name: build
|
|
run: |
|
|
set -xe
|
|
echo "sourceurl: https://github.com/$GITHUB_REPOSITORY" >> _config.yml
|
|
cat _config.yml
|
|
env BUNDLE_SILENCE_ROOT_WARNING=true bundle update --bundler
|
|
env BUNDLE_SILENCE_ROOT_WARNING=true bundle install
|
|
env BUNDLE_SILENCE_ROOT_WARNING=true JEKYLL_ENV=production bundle exec xvfb-run make V=2 -O -j$(nproc) jekyll
|
|
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
name: publish
|
|
run: |
|
|
|
|
git config user.name "${GITHUB_ACTOR}"
|
|
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
|
git remote set-url --push origin https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
|
|
make -O V=1 publish
|
|
|
|
- if: github.event_name != 'push' || github.ref != 'refs/heads/main'
|
|
name: artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: website
|
|
path: _site
|
|
|