Skip to content

Commit

Permalink
ci: Automatically generate a release from a tag, upload pdf version t…
Browse files Browse the repository at this point in the history
…o release.
  • Loading branch information
jwalton committed Apr 27, 2023
1 parent a998788 commit bff0877
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/deploy-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- master
tags:
- "*"
pull_request:
branches:
- master
Expand All @@ -23,6 +25,7 @@ jobs:
- name: Build
run: npm run build
- name: Upload build artifacts
if: "!startsWith(github.ref, 'refs/tags/')"
uses: actions/upload-artifact@v3
with:
name: build-output
Expand All @@ -32,6 +35,9 @@ jobs:
name: Deploy
runs-on: ubuntu-latest
needs: build
# Only deploy non-tagged builds (otherwise we deploy twice when
# we tag a release).
if: "!startsWith(github.ref, 'refs/tags/')"
permissions:
contents: write
steps:
Expand All @@ -53,7 +59,11 @@ jobs:
pdf:
name: Generate PDF Version
runs-on: ubuntu-latest
permissions:
contents: write
needs: build
# Generate a new release every time there's a tag.
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
Expand All @@ -75,10 +85,9 @@ jobs:
# Generate PDF
npx docusaurus-prince-pdf -u http://localhost:1337/rust-book-abridged --output rust-book-abridged.pdf
# Kill server
fuser -k 1337/tcp
- name: Upload PDF Artifact
uses: actions/upload-artifact@v3
fuser -k 1337/tcp
- uses: ncipollo/release-action@v1
with:
name: rust-book-abridged.pdf
path: rust-book-abridged.pdf
if-no-files-found: error
generateReleaseNotes: true
makeLatest: true
artifacts: "rust-book-abridged.pdf"
2 changes: 1 addition & 1 deletion docs/ch00-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ hide_title: true

<div align="center">
<h1>The Rust Book (Abridged)</h1>
<p>v0.2.0 - Draft</p>
<p>v0.2.1 - Draft</p>
<p>By Jason Walton</p>
<p>Based on <a href="https://doc.rust-lang.org/stable/book/">"The Rust Programming Language"</a> by Steve Klabnik and Carol Nichols.</p>
</div>
Expand Down

0 comments on commit bff0877

Please sign in to comment.