Skip to content

Commit

Permalink
docs/, .github/workflow/infradocs.yml: improve CI
Browse files Browse the repository at this point in the history
  • Loading branch information
classabbyamp committed Aug 11, 2023
1 parent fe104ec commit 5c55c55
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 14 deletions.
55 changes: 42 additions & 13 deletions .github/workflows/infradocs.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,63 @@
name: infradocs

on:
pull_request:
branches:
- master
paths:
- docs/**
push:
branches:
- master
paths:
- 'docs/**'
- docs/**

jobs:
main:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout repo
uses: classabbyamp/treeless-checkout-action@v1

- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
submodules: false
images: |
ghcr.io/${{ github.repository_owner }}/infradocs
tags: |
type=sha,prefix=
type=raw,value=latest,enable={{is_default_branch}}
flavor: latest=false
labels: |
org.opencontainers.image.authors=Void Linux team and contributors
org.opencontainers.image.url=https://voidlinux.org
org.opencontainers.image.documentation=https://infradocs.voidlinux.org
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.vendor=Void Linux
org.opencontainers.image.title=Void Linux infrastructure documentation
org.opencontainers.image.description=infrastructure documentation image for Void Linux
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Login to GCHR
uses: docker/login-action@v1
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: void-robot
password: ${{ secrets.CR_PAT }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
push: true
tags: "ghcr.io/void-linux/infradocs:${{github.sha}}"
context: docs
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
1 change: 0 additions & 1 deletion docs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ COPY . .
RUN mdbook build

FROM busybox:stable
LABEL org.opencontainers.image.source https://github.com/void-linux/void-infrastructure
WORKDIR /web
COPY --from=build /book/book .
ENTRYPOINT ["/bin/busybox", "httpd", "-f", "-p", "8080"]

0 comments on commit 5c55c55

Please sign in to comment.