Fix deprecated gh-pages action (#754) #313
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: gh-pages | |
on: | |
push: | |
branches: | |
- "main" | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: arduino/setup-protoc@v2 | |
# caution: this is the same restore as in ci.yaml | |
- name: Restore Cargo Cache | |
id: cargo-cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
# We can do this now because we use specific verison and update with Dependabot | |
# but if we make the deps any less specifc, we'll have to fix | |
key: ${{ runner.os }}-deps-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('**/*.rs') }} | |
# start from the previous set of cached dependencies | |
restore-keys: | | |
${{ runner.os }}-deps-${{ hashFiles('**/Cargo.toml') }}- | |
${{ runner.os }}-deps- | |
- name: Build | |
run: cargo doc --document-private-items --no-deps | |
- name: Set up _site redirect to firewood | |
run: | | |
rm -fr _site | |
mkdir _site | |
echo "<meta http-equiv=\"refresh\" content=\"0; url=firewood\">" > _site/index.html | |
- name: Copy doc files to _site | |
run: | | |
cp -rv target/doc/* ./_site | |
cp -rv docs/assets ./_site | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pages | |
path: _site | |
if-no-files-found: error | |
overwrite: true | |
include-hidden-files: true | |
deploy: | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download pages artifact | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: pages | |
path: . | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: . | |
- name: Deploy to GitHub pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |