refactor(targets): use get_url
util for subpaths
#572
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: Docs | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: docs | |
cancel-in-progress: false | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
deployments: write | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Stable Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- name: Cargo Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }} | |
- name: Clean docs folder | |
run: cargo clean --doc | |
- name: Build docs | |
run: cargo doc --no-deps --release | |
- name: Add redirect | |
run: | | |
echo '<meta http-equiv="refresh" content="0;url=/autopulse/index.html">' > target/doc/index.html | |
- name: Remove lock file | |
run: rm target/doc/.lock | |
- name: Publish to Cloudflare Pages | |
uses: dan-online/pages-action@main | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: autopulse | |
directory: target/doc | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
productionBranch: main | |
- name: Clean docs folder | |
run: cargo clean --doc |