|
| 1 | +# This file is part of Dependency-Track. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +# |
| 15 | +# SPDX-License-Identifier: Apache-2.0 |
| 16 | +# Copyright (c) OWASP Foundation. All Rights Reserved. |
| 17 | +name: docs |
| 18 | + |
| 19 | +on: |
| 20 | + push: |
| 21 | + branches: [main] |
| 22 | + tags: ["v[0-9]+.[0-9]+.[0-9]+"] |
| 23 | + pull_request: |
| 24 | + branches: [main] |
| 25 | + |
| 26 | +permissions: {} |
| 27 | + |
| 28 | +jobs: |
| 29 | + lint: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + if: github.event_name == 'pull_request' |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 34 | + with: |
| 35 | + persist-credentials: false |
| 36 | + - name: Lint Markdown |
| 37 | + run: make lint-markdown |
| 38 | + - name: Lint YAML |
| 39 | + run: make lint-yaml |
| 40 | + - name: Lint prose |
| 41 | + run: make lint-prose |
| 42 | + - name: Build |
| 43 | + run: make build |
| 44 | + |
| 45 | + deploy: |
| 46 | + runs-on: ubuntu-latest |
| 47 | + if: github.event_name == 'push' |
| 48 | + permissions: |
| 49 | + contents: write |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 52 | + with: |
| 53 | + fetch-depth: 0 |
| 54 | + persist-credentials: false |
| 55 | + - name: Configure git |
| 56 | + run: | |
| 57 | + git config user.name "github-actions[bot]" |
| 58 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 59 | + git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" |
| 60 | + env: |
| 61 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + - name: Set up Python |
| 63 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 64 | + with: |
| 65 | + python-version: "3.14" |
| 66 | + - name: Install dependencies |
| 67 | + run: pip install mike "mkdocs-material[imaging]==9.6.*" -r requirements.txt |
| 68 | + - name: Deploy next |
| 69 | + if: github.ref == 'refs/heads/main' |
| 70 | + run: mike deploy --push next |
| 71 | + - name: Deploy release |
| 72 | + if: startsWith(github.ref, 'refs/tags/v') |
| 73 | + run: | |
| 74 | + TAG="${GITHUB_REF#refs/tags/v}" |
| 75 | + MINOR="${TAG%.*}" |
| 76 | + mike deploy --push --update-aliases "$MINOR" latest |
| 77 | + mike set-default --push latest |
0 commit comments