Skip to content

Commit 6394eb9

Browse files
authored
Merge pull request #1647 from ehuss/preview-artifact
Add preview artifacts in CI
2 parents 81477c4 + 431b4ff commit 6394eb9

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/main.yml

+29
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,34 @@ jobs:
9898
working-directory: ./mdbook-spec
9999
run: cargo fmt --check
100100

101+
preview:
102+
if: github.event_name == 'pull_request'
103+
runs-on: ubuntu-latest
104+
steps:
105+
- uses: actions/checkout@master
106+
- name: Update rustup
107+
run: rustup self update
108+
- name: Install Rust
109+
run: |
110+
rustup set profile minimal
111+
rustup toolchain install nightly
112+
rustup default nightly
113+
- name: Install mdbook
114+
run: |
115+
mkdir bin
116+
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
117+
echo "$(pwd)/bin" >> $GITHUB_PATH
118+
- name: Build the book
119+
env:
120+
SPEC_RELATIVE: 0
121+
run: mdbook build --dest-dir dist/preview-${{ github.event.pull_request.number }}
122+
- name: Upload artifact
123+
uses: actions/upload-artifact@v4
124+
with:
125+
name: preview-${{ github.event.pull_request.number }}
126+
overwrite: true
127+
path: dist
128+
101129
# The success job is here to consolidate the total success/failure state of
102130
# all other jobs. This job is then included in the GitHub branch protection
103131
# rule which prevents merges unless all other jobs are passing. This makes
@@ -110,6 +138,7 @@ jobs:
110138
- code-tests
111139
- style-tests
112140
- mdbook-spec
141+
# preview is explicitly excluded here since it doesn't run on merge
113142
runs-on: ubuntu-latest
114143
steps:
115144
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'

0 commit comments

Comments
 (0)