Skip to content

use hugo for docs

use hugo for docs #5

Workflow file for this run

name: Build
on:
workflow_call:
inputs:
tags:
type: string
description: The Docker Tags (see docker/metadata-action@v4 for available values)
required: true
push:
default: true
type: boolean
description: Push the Docker Images?
required: false
gke-cluster:
type: string
description: Google Kubernetes Engine Cluster
required: true
gke-zone:
type: string
description: Google Kubernetes Engine Zone
required: true
secrets:
gke-credentials:
description: Google Kubernetes Engine Credentials as JSON
required: true
gke-project:
description: Google Kubernetes Engine Project
required: true
gh-key:
description: GitHub Key
required: true
outputs:
version:
description: The Docker Image Version
value: ${{ jobs.php.outputs.version }}
jobs:
php:
name: PHP
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout
uses: actions/checkout@v3
# gcloud does not work with Python 3.10 because collections.Mappings was removed in Python 3.10.
- uses: actions/setup-python@v4
with:
python-version: 3.9.15
- name: Auth gcloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.gke-credentials }}
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.gke-project }}
- name: Configure gcloud
run: |
gcloud --quiet auth configure-docker
gcloud container clusters get-credentials ${{ inputs.gke-cluster }} --zone ${{ inputs.gke-zone }}
- name: Docker metadata
id: docker-metadata
uses: docker/metadata-action@v4
with:
images: eu.gcr.io/${{ secrets.gke-project }}/website/php
tags: |
type=raw,value=${{ github.sha }},priority=9999
${{ inputs.tags }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./api
target: php_prod
pull: true
push: ${{ inputs.push }}
tags: ${{ steps.docker-metadata.outputs.tags }}
labels: ${{ steps.docker-metadata.outputs.labels }}
cache-from: |
type=registry,ref=eu.gcr.io/${{ secrets.gke-project }}/website/caddy:latest
type=registry,ref=eu.gcr.io/${{ secrets.gke-project }}/website/php:latest
type=registry,ref=eu.gcr.io/${{ secrets.gke-project }}/website/caddy:${{ github.sha }}
type=registry,ref=eu.gcr.io/${{ secrets.gke-project }}/website/php:${{ github.sha }}
cache-to: type=inline
outputs:
version: ${{ github.sha }}
caddy:
name: Caddy
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout
uses: actions/checkout@v3
# gcloud does not work with Python 3.10 because collections.Mappings was removed in Python 3.10.
- uses: actions/setup-python@v4
with:
python-version: 3.9.15
- name: Auth gcloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.gke-credentials }}
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.gke-project }}
- name: Configure gcloud
run: |
gcloud --quiet auth configure-docker
gcloud container clusters get-credentials ${{ inputs.gke-cluster }} --zone ${{ inputs.gke-zone }}
- name: Docker metadata
id: docker-metadata
uses: docker/metadata-action@v4
with:
images: eu.gcr.io/${{ secrets.gke-project }}/website/caddy
tags: |
type=raw,value=${{ github.sha }},priority=9999
${{ inputs.tags }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./api
target: caddy_prod
pull: true
push: ${{ inputs.push }}
tags: ${{ steps.docker-metadata.outputs.tags }}
labels: ${{ steps.docker-metadata.outputs.labels }}
cache-from: |
type=registry,ref=eu.gcr.io/${{ secrets.gke-project }}/website/caddy:latest
type=registry,ref=eu.gcr.io/${{ secrets.gke-project }}/website/php:latest
type=registry,ref=eu.gcr.io/${{ secrets.gke-project }}/website/caddy:${{ github.sha }}
type=registry,ref=eu.gcr.io/${{ secrets.gke-project }}/website/php:${{ github.sha }}
cache-to: type=inline
outputs:
version: ${{ github.sha }}
pwa:
name: PWA
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout
uses: actions/checkout@v3
# gcloud does not work with Python 3.10 because collections.Mappings was removed in Python 3.10.
- uses: actions/setup-python@v4
with:
python-version: 3.9.15
- name: Auth gcloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.gke-credentials }}
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.gke-project }}
- name: Configure gcloud
run: |
gcloud --quiet auth configure-docker
gcloud container clusters get-credentials ${{ inputs.gke-cluster }} --zone ${{ inputs.gke-zone }}
- name: Docker metadata
id: docker-metadata
uses: docker/metadata-action@v4
with:
images: eu.gcr.io/${{ secrets.gke-project }}/website/pwa
tags: |
type=raw,value=${{ github.sha }},priority=9999
${{ inputs.tags }}
- name: Define URL
run: |
set -o pipefail
if [[ "${{ github.ref }}" == 'refs/heads/main' ]]; then
echo "URL=api-platform.com" >> "$GITHUB_ENV"
else
CONTEXT=nonprod
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
export RELEASE_NAME=pr-$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
else
export RELEASE_NAME=${{ github.ref_name }}
fi
echo "URL=$RELEASE_NAME.apip.preprod-tilleuls.ovh" >> "$GITHUB_ENV"
fi
- name: Fetch documentation
working-directory: ./pwa
run: bash tools/get-docs.sh
- name: Compute source documentation
working-directory: ./pwa
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: phive
run: bash tools/get-core-docs.sh
- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./pwa
target: prod
pull: true
push: ${{ inputs.push }}
tags: ${{ steps.docker-metadata.outputs.tags }}
labels: ${{ steps.docker-metadata.outputs.labels }}
build-args: |
NEXT_ROOT_URL=${{ env.URL }}
cache-from: |
type=registry,ref=eu.gcr.io/${{ secrets.gke-project }}/website/pwa:latest
type=registry,ref=eu.gcr.io/${{ secrets.gke-project }}/website/pwa:${{ github.sha }}
cache-to: type=inline
secrets: |
"GITHUB_KEY=${{ secrets.gh-key }}"
outputs:
version: ${{ github.sha }}