Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push container images #113

Merged
merged 9 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/docs-build-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: docs-build-pr

on:
pull_request:
branches: [ main ]
types: [ opened, synchronize ]

env:
GH_TOKEN: ${{ github.token }}

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
load: true
tags: pr-image:${{ github.sha }}
- name: Build docs
run: |
docker run -v $(pwd):/work -w /work pr-image:${{ github.sha }} ./repo docs
- name: Delete unnecessary files
run: |
sudo find _build -name .doctrees -prune -exec rm -rf {} \;
sudo find _build -name .buildinfo -exec rm {} \;
- name: Copy review page
run: |
sudo mv _build/docs/review/latest/* _build/docs
sudo rm -rf _build/docs/review _build/docs/tmp _build/docs/sphinx_warnings.txt
- name: Upload HTML
uses: actions/upload-artifact@v4
with:
name: html-build-artifact
path: _build/docs
if-no-files-found: error
retention-days: 1
- name: Store PR information
run: |
mkdir ./pr
echo ${{ github.event.number }} > ./pr/pr.txt
echo ${{ github.event.pull_request.merged }} > ./pr/merged.txt
echo ${{ github.event.action }} > ./pr/action.txt
- name: Upload PR information
uses: actions/upload-artifact@v4
with:
name: pr
path: pr/
24 changes: 7 additions & 17 deletions .github/workflows/docs-build.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
name: docs-build

on:
pull_request:
branches: [ master, main ]
types: [ opened, synchronize ]

push:
branches: [ master, main ]
branches: [ main ]
tags:
- v*
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
TAG: 0.2.0
TAG: 0.3.0
GH_TOKEN: ${{ github.token }}

concurrency:
Expand All @@ -33,8 +29,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
Expand Down Expand Up @@ -77,8 +71,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
Expand All @@ -95,16 +89,13 @@ jobs:

build-docs:
needs: [dockerfile-changed, build-and-push-image]
if: ${{ always() }}
runs-on: ubuntu-latest
container:
image: ${{ needs.dockerfile-changed.outputs.image }}
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set ownership
run: |
chown -R $(id -u):$(id -g) $PWD
- name: Build docs
run: |
./repo docs
Expand All @@ -124,7 +115,7 @@ jobs:
if-no-files-found: error
retention-days: 1
- name: Store PR information
if: ${{ github.event_name == 'pull_request' }}
if: github.event_name == 'pull_request'
run: |
mkdir ./pr
echo ${{ github.event.number }} > ./pr/pr.txt
Expand All @@ -139,7 +130,6 @@ jobs:

store-html:
needs: [ build-docs ]
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs-preview-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: docs-preview-pr

on:
workflow_run:
workflows: [ docs-build ]
workflows: [ docs-build-pr ]
types: [ completed ]
branches-ignore: [ 'master' ]
branches-ignore: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down