File: docs.yml

package info (click to toggle)
rust-doxx 0.1.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 4,532 kB
  • sloc: sh: 78; ruby: 15; makefile: 9
file content (71 lines) | stat: -rw-r--r-- 1,743 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Deploy Documentation

on:
  push:
    branches: ["main"]

  workflow_dispatch:

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: "pages"
  cancel-in-progress: false

jobs:
  build:
    if: ${{ github.actor == 'bgreenwell' }}

    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v5

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Cache dependencies
        uses: Swatinem/rust-cache@v2

      - name: Build documentation
        run: cargo doc --no-deps

      - name: Create redirect page
        run: echo '<meta http-equiv="refresh" content="0; url=doxx">' > target/doc/index.html

      - name: Setup Pages
        id: pages
        uses: actions/configure-pages@v5
        continue-on-error: true

      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: "./target/doc"

  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    needs: build
    if: success()
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4
        continue-on-error: true

      - name: Pages deployment status
        run: |
          if [ "${{ steps.deployment.outcome }}" == "failure" ]; then
            echo "::warning::GitHub Pages deployment failed. Please enable Pages in repository settings:"
            echo "::warning::1. Go to Settings > Pages"
            echo "::warning::2. Set Source to 'GitHub Actions'" 
            echo "::warning::3. Re-run this workflow"
          else
            echo "Documentation deployed successfully!"
          fi