Skip to content

Commit

Permalink
Add preview artifacts in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Oct 8, 2024
1 parent c64e52a commit 2f153e5
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: CI
on:
pull_request:
merge_group:
push:

env:
MDBOOK_VERSION: 0.4.40
Expand Down Expand Up @@ -98,6 +99,38 @@ jobs:
working-directory: ./mdbook-spec
run: cargo fmt --check

preview:
# if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Update rustup
run: rustup self update
- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain install nightly
rustup default nightly
- name: Install mdbook
run: |
mkdir bin
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
echo "$(pwd)/bin" >> $GITHUB_PATH
- name: Build the book
env:
SPEC_RELATIVE: 0
run: mdbook build
- name: Work-around upload-artifact
# Needed because upload-artifact always removes the top-level directory,
# and it would be convenient to keep it.
run: mkdir dist && mv book dist/preview-1234
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: preview-1234
overwrite: true
path: dist

# The success job is here to consolidate the total success/failure state of
# all other jobs. This job is then included in the GitHub branch protection
# rule which prevents merges unless all other jobs are passing. This makes
Expand All @@ -110,6 +143,7 @@ jobs:
- code-tests
- style-tests
- mdbook-spec
# preview is explicitly excluded here since it doesn't run on merge
runs-on: ubuntu-latest
steps:
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
Expand Down

0 comments on commit 2f153e5

Please sign in to comment.