From 45cdc5a81783cea14b1f0e33d798759787f0921b Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Thu, 20 Oct 2022 18:36:02 +0200 Subject: [PATCH 1/2] Dockerfile.*: add RANCHER_DOCS_PACKAGE arg Signed-off-by: Kyr Shatskyy --- Dockerfile.algolia | 5 +++-- Dockerfile.dev | 3 ++- Dockerfile.prod | 3 ++- Dockerfile.staging | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile.algolia b/Dockerfile.algolia index 6c334240e..1525cfc2c 100644 --- a/Dockerfile.algolia +++ b/Dockerfile.algolia @@ -1,6 +1,7 @@ -FROM rancher/docs:latest as prod +ARG RANCHER_DOCS_PACKAGE=rancher/docs +FROM $RANCHER_DOCS_PACKAGE:latest as prod -FROM rancher/docs:build +FROM $RANCHER_DOCS_PACKAGE:build COPY --from=prod /usr/share/nginx/html/docs/final.algolia.json /run WORKDIR /run diff --git a/Dockerfile.dev b/Dockerfile.dev index af34fcf57..9c3095e4b 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,4 +1,5 @@ -FROM rancher/docs:build +ARG RANCHER_DOCS_PACKAGE=rancher/docs +FROM $RANCHER_DOCS_PACKAGE:build ENV HUGO_ENV dev VOLUME ["/run/archetypes", "/run/assets", "/run/content", "/run/data", "/run/layouts", "/run/scripts", "/run/static", "/run/.git"] diff --git a/Dockerfile.prod b/Dockerfile.prod index 38ba46de6..4061df589 100644 --- a/Dockerfile.prod +++ b/Dockerfile.prod @@ -1,4 +1,5 @@ -FROM rancher/docs:build as build +ARG RANCHER_DOCS_PACKAGE=rancher/docs +FROM $RANCHER_DOCS_PACKAGE:build as build ENV HUGO_ENV production WORKDIR /run diff --git a/Dockerfile.staging b/Dockerfile.staging index 5dc307686..ba6fb73e4 100644 --- a/Dockerfile.staging +++ b/Dockerfile.staging @@ -1,4 +1,5 @@ -FROM rancher/docs:build as build +ARG RANCHER_DOCS_PACKAGE=rancher/docs +FROM $RANCHER_DOCS_PACKAGE:build as build ENV HUGO_ENV staging WORKDIR /run From 8969e999cd8952e1e57efd9a3bec6a134f51efd6 Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Thu, 20 Oct 2022 14:42:10 +0200 Subject: [PATCH 2/2] github: add release docs workflow Signed-off-by: Kyr Shatskyy --- .github/workflows/release-docs.yml | 150 +++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 .github/workflows/release-docs.yml diff --git a/.github/workflows/release-docs.yml b/.github/workflows/release-docs.yml new file mode 100644 index 000000000..87d694e8a --- /dev/null +++ b/.github/workflows/release-docs.yml @@ -0,0 +1,150 @@ +--- +name: Release Docs +on: push + +jobs: + publish-dev: + if: ${{ github.ref == 'refs/heads/master' }} + runs-on: ubuntu-latest + steps: + - name: Checkout Docs + uses: actions/checkout@v3 + - name: Login ghcr.io + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ github.token }} + + # when push to master + - name: Build Dev Container + uses: docker/build-push-action@v3 + with: + push: true + file: Dockerfile.dev + tags: | + ghcr.io/${{ github.repository }}:dev + context: . + build-args: | + RANCHER_DOCS_PACKAGE=ghcr.io/${{ github.repository }} + + publish-build: + if: ${{ github.ref == 'refs/heads/master' }} + runs-on: ubuntu-latest + steps: + - name: Checkout Docs + uses: actions/checkout@v3 + - name: Login ghcr.io + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ github.token }} + # when push to staging + - name: Build Staging + uses: docker/build-push-action@v3 + with: + push: true + file: Dockerfile.build + context: . + tags: | + ghcr.io/${{ github.repository }}:build + build-args: | + RANCHER_DOCS_PACKAGE=ghcr.io/${{ github.repository }} + + publish-staging: + if: ${{ github.ref == 'refs/heads/staging' }} + runs-on: ubuntu-latest + steps: + - name: Checkout Docs + uses: actions/checkout@v3 + - name: Login ghcr.io + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ github.token }} + # when push to staging + - name: Build Staging + uses: docker/build-push-action@v3 + with: + push: true + file: Dockerfile.staging + context: . + tags: | + ghcr.io/${{ github.repository }}:staging + build-args: | + RANCHER_DOCS_PACKAGE=ghcr.io/${{ github.repository }} + + publish-latest: + if: ${{ github.ref == 'refs/heads/master' }} + runs-on: ubuntu-latest + steps: + - name: Checkout Docs + uses: actions/checkout@v3 + - name: Login ghcr.io + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ github.token }} + # when push to master + - name: Build and Publish Latest + uses: docker/build-push-action@v3 + with: + push: true + file: Dockerfile.prod + context: . + tags: | + ghcr.io/${{ github.repository }}:latest + build-args: | + RANCHER_DOCS_PACKAGE=ghcr.io/${{ github.repository }} + + publish-algolia: + if: ${{ github.ref == 'refs/heads/master' }} + runs-on: ubuntu-latest + needs: + - publish-latest + steps: + - name: Checkout Docs + uses: actions/checkout@v3 + - name: Login ghcr.io + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ github.token }} + # when push to master + - name: Build and Publish algolia + uses: docker/build-push-action@v3 + with: + push: true + file: Dockerfile.algolia + context: . + tags: | + ghcr.io/${{ github.repository }}:algolia + build-args: | + RANCHER_DOCS_PACKAGE=ghcr.io/${{ github.repository }} + test-prod: + if: ${{ github.event_name == 'pull_request' }} + runs-on: ubuntu-latest + steps: + - name: Checkout Docs + uses: actions/checkout@v3 + - name: Login ghcr.io + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ github.token }} + - name: Test Build + uses: docker/build-push-action@v3 + with: + file: Dockerfile.prod + context: . + tags: | + ghcr.io/${{ github.repository }}:${{ github.ref_name }} + build-args: | + RANCHER_DOCS_PACKAGE=ghcr.io/${{ github.repository }} + +