Skip to content

Fix typo in #142

Fix typo in #142 #1013

Workflow file for this run

name: build
on:
push:
branches: ["*"]
pull_request:
branches: ["*"]
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
env:
LSI: "true"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
- name: Cache Ruby gems
uses: actions/cache@v4
env:
CACHE_ID: 1
with:
path: |
Gemfile.lock
vendor/bundle
key: ${{ runner.os }}-bundler-${{ env.CACHE_ID }}-${{ hashFiles('Gemfile') }}
restore-keys: |
${{ runner.os }}-bundler-${{ env.CACHE_ID }}-
- name: Install system packages
run: |
sudo debconf-communicate <<< "set man-db/auto-update false"
sudo dpkg-reconfigure man-db
sudo apt update
sudo NEEDRESTART_SUSPEND=1 \
apt install -y libgsl-dev
- name: Install dependencies
env:
MAKE: 'make -j4'
run: |
bundle config set --local path vendor/bundle
bundle config set without 'development'
bundle install --jobs=4 --retry=3
bundle clean
# debugging algolia slow bug
sed -i '/status = get_task_status(index_name, taskID, request_options)/a\ puts status' vendor/bundle/ruby/*/gems/algoliasearch-*/lib/algolia/client.rb
- name: Prepare build
if: github.ref == 'refs/heads/master'
run: |
git clone --depth=1 --branch=gh-pages --single-branch --no-checkout \
"https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" \
_site
- name: Run Jekyll Doctor
run: |
bundle exec jekyll doctor --trace --profile
env:
JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build site
run: |
bundle exec jekyll build --trace --profile --strict_front_matter
: > _site/.nojekyll
env:
JEKYLL_ENV: production
JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/master'
run: |
CINFO="$(git log -1 --pretty="%an: [%h] %s")"
pushd _site/ &>/dev/null
echo -n lug.ustc.edu.cn > CNAME
git add -A
git -c user.name=GitHub -c [email protected] commit \
-m "Auto deploy from GitHub Actions build ${GITHUB_RUN_NUMBER}" \
-m "$CINFO"
git push
popd &>/dev/null
- name: Update Algolia index
if: github.ref == 'refs/heads/master'
run: bundle exec jekyll algolia push
env:
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
- name: Call webhook
if: "github.repository == 'ustclug/website' && github.ref == 'refs/heads/master'"
continue-on-error: true
env:
WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }}
run: ruby _scripts/webhook.rb