Skip to content

Commit

Permalink
Fix docs GH action
Browse files Browse the repository at this point in the history
The following changes are made in this commit:
* addging a missing GH pages setup step
* docs: add baseurl build arg
* naming the docs pipeline
* permissions fix in the GH docs workflow
* updating the trigger on the docs workflow
* moving default to Dockerfile instead of the bake config

Co-authored-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>, James Hewitt <james.hewitt@uk.ibm.com>
Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
  • Loading branch information
milosgajdos and Jamstah committed Oct 15, 2023
1 parent 6b8beb4 commit d522697
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: docs

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -7,6 +9,8 @@ on:
branches:
- main
paths:
- .github/workflows/docs.yml
- dockerfiles/docs.Dockerfile
- docs/**
workflow_dispatch:

Expand All @@ -20,6 +24,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build docs
Expand All @@ -31,6 +38,13 @@ jobs:
set: |
*.cache-from=type=gha,scope=docs
*.cache-to=type=gha,scope=docs,mode=max
env:
DOCS_BASEURL: ${{ steps.pages.outputs.base_path }}
- name: Fix permissions
run: |
chmod -c -R +rX "./build/docs" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v2
with:
Expand Down
7 changes: 7 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,15 @@ target "image-all" {
]
}

variable "DOCS_BASEURL" {
default = null
}

target "_common_docs" {
dockerfile = "./dockerfiles/docs.Dockerfile"
args = {
DOCS_BASEURL = DOCS_BASEURL
}
}

target "docs-export" {
Expand Down
3 changes: 2 additions & 1 deletion dockerfiles/docs.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ COPY --from=hugo $GOPATH/bin/hugo /bin/hugo
WORKDIR /src

FROM build-base AS build
ARG DOCS_BASEURL=/
RUN --mount=type=bind,rw,source=docs,target=. \
hugo --gc --minify --destination /out
hugo --gc --minify --destination /out -b $DOCS_BASEURL

FROM build-base AS server
COPY docs .
Expand Down

0 comments on commit d522697

Please sign in to comment.