mirror of
https://github.com/ostreedev/ostree.git
synced 2025-01-06 17:18:25 +03:00
8d1373bdd7
A couple fixes to make PRs and non-PRs work correctly: * In a conditional expression, `true` or `false` are returned unless you terminate both sides in a ternary. That was causing 2 strings to be suffixed with `false` instead of an empty string. * For a PR, we do actually want to cancel in progress runs since there's no danger of breaking an in progress deployment. * For PRs, just use the same `github-pages-pr` name for the artifact. The important part is that it's not called `github-pages` where an in progress deployment could pick it up. Otherwise it can use the same name all the time.
87 lines
2.7 KiB
YAML
87 lines
2.7 KiB
YAML
---
|
|
# This is a slightly adjusted version of the Jekyll pages starter workflow.
|
|
# https://github.com/actions/starter-workflows/blob/main/pages/jekyll-gh-pages.yml
|
|
name: Docs
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
# Allow only one concurrent deployment, skipping runs queued between the run
|
|
# in-progress and latest queued. However, do NOT cancel in-progress runs as we
|
|
# want to allow these production deployments to complete.
|
|
#
|
|
# Since pull requests use a unique artifact name and won't be deployed, they
|
|
# shouldn't be limited. Use a unique group name in that case and let in
|
|
# progress runs be cancelled.
|
|
concurrency:
|
|
group: "pages${{ github.event_name == 'pull_request' && format('-pr{0}', github.event.number) || '' }}"
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
jobs:
|
|
build:
|
|
name: Build documentation
|
|
runs-on: ubuntu-latest
|
|
container: registry.ci.openshift.org/coreos/fcos-buildroot:testing-devel
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: GH actions checkout post
|
|
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
|
|
# This is taken from ci/travis-install.sh but should probably be
|
|
# refactored.
|
|
- name: Install dependencies
|
|
run: ./ci/installdeps.sh
|
|
|
|
- name: Build API docs and manpages
|
|
run: |
|
|
./autogen.sh --enable-gtk-doc --enable-man --enable-man-html
|
|
make -C apidoc
|
|
make manhtml
|
|
|
|
- name: Copy API docs and manpages
|
|
run: ./docs/prep-docs.sh
|
|
|
|
- name: Build jekyll docs
|
|
uses: actions/jekyll-build-pages@v1
|
|
with:
|
|
source: ./docs
|
|
destination: ./docs/_site
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-pages-artifact@v3
|
|
with:
|
|
path: docs/_site
|
|
# The default name is github-pages to match actions/deploy-pages. For
|
|
# PRs use a different name so results can be inspected without real
|
|
# deployments accidentally getting the wrong artifact.
|
|
name: "github-pages${{ github.event_name == 'pull_request' && '-pr' || '' }}"
|
|
|
|
deploy:
|
|
name: Deploy documentation
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
# Skip deployment on pull requests.
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
|
|
# Grant permissions to deploy to Pages. The id-token permission is needed
|
|
# to verify the deployment originates from an appropriate source.
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
|
|
steps:
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v4
|