mirror of
https://github.com/mainmatter/100-exercises-to-learn-rust
synced 2024-12-26 21:58:49 +01:00
1aae615bb4
We use an mdbook preprocessor to automatically generate links to the relevant exercise for each section. We remove all existing manual links and refactor the deploy process to push the rendered book to a branch.
56 lines
No EOL
1.5 KiB
YAML
56 lines
No EOL
1.5 KiB
YAML
name: "CI"
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
- name: Install plugin
|
|
run: cargo install --path helpers/mdbook-exercise-linker
|
|
- uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: mdbook
|
|
- name: Build book
|
|
run: |
|
|
cd book
|
|
mdbook build
|
|
- name: Link Checker
|
|
uses: lycheeverse/lychee-action@v1
|
|
with:
|
|
fail: true
|
|
args: |
|
|
--exclude-loopback
|
|
--require-https
|
|
--no-progress
|
|
book/book
|
|
# Upload the book as an artifact
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: book
|
|
path: book/book
|
|
# Commit and push all changed files.
|
|
# Must only affect files that are listed in "paths-ignore".
|
|
- name: Git commit build artifacts
|
|
# Only run on main branch push (e.g. pull request merge).
|
|
if: github.event_name == 'push'
|
|
run: |
|
|
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
|
|
git config --global user.email "username@users.noreply.github.com"
|
|
git add --force book/book
|
|
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
|
|
git push --set-upstream --force-with-lease origin deploy
|
|
|
|
formatter:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: dprint/check@v2.2 |