Merge pull request #4343 from kshtsk/wip-release-docs

add action to release docs
This commit is contained in:
Billy Tat 2022-11-02 10:56:40 -07:00 committed by GitHub
commit cff8e476cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 159 additions and 5 deletions

150
.github/workflows/release-docs.yml vendored Normal file
View File

@ -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 }}

View File

@ -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

View File

@ -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"]

View File

@ -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

View File

@ -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