Skip to content

use MyAccessId as AAI endpoint #90

use MyAccessId as AAI endpoint

use MyAccessId as AAI endpoint #90

Workflow file for this run

name: workflows starter
# env: is empty, see setup-env and the outputs there
on:
push:
branches: [master, develop]
workflow_dispatch: {}
jobs:
setup_workflow_env:
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.get_environment_from_git_ref.outputs.environment }}
environment_short: ${{ steps.get_environment_from_git_ref.outputs.environment_short }}
image_name: api
registry_root: ghcr.io/${{ github.repository }}/
default_port: "8080"
submodules: "true"
APP_NAME: api
APP_ROOT: "/"
steps:
- name: Get environment from git ref
id: get_environment_from_git_ref
run: |
echo "Running on branch ${{ github.ref_name }}"
if [ "${{ github.ref }}" = "refs/heads/master" ]; then
echo "environment=production"
echo "environment=production" >> $GITHUB_OUTPUT
echo "environment_short=prod" >> $GITHUB_OUTPUT
else
echo "environment=review/${{ github.ref_name }}"
echo "environment=review/${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "environment_short=$(echo -n ${{ github.ref_name }} | sed s/feature_// | tr '_' '-' | tr '[:upper:]' '[:lower:]' )" >> $GITHUB_OUTPUT
fi
_1:
needs: [setup_workflow_env]
environment: ${{ needs.setup_workflow_env.outputs.environment }}
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create tags based on git data
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ needs.setup_workflow_env.outputs.registry_root }}${{ needs.setup_workflow_env.outputs.image_name }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value={{sha}}
- name: Create build environment
env:
SECRETS_CONTEXT: ${{ toJson(secrets) }}
VARS_CONTEXT: ${{ toJson(vars) }}
run: |
echo -n "$SECRETS_CONTEXT" | jq -r '[to_entries[]|select(.key|startswith("K8S_SECRET_"))]|map("\(.key|sub("K8S_SECRET_"; ""))=\(.value|tostring|@sh)")|.[]' > secrets.env
echo -n "$VARS_CONTEXT" | jq -r '[to_entries[]|select(.key|startswith("K8S_SECRET_"))]|map(" \(.key|sub("K8S_SECRET_"; "")): \(.value|tostring|@base64)")|.[]' >> secrets.env
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile-acdh-ch
platforms: linux/amd64
push: true
secret-files: |
"secrets_env=./secrets.env"
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Create tags based on git data Solr
id: meta-solr
uses: docker/metadata-action@v4
with:
images: |
${{ needs.setup_workflow_env.outputs.registry_root }}${{ needs.setup_workflow_env.outputs.image_name }}-solr
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value={{sha}}
- name: Build and push Solr
uses: docker/build-push-action@v4
with:
context: etc/solr
platforms: linux/amd64
push: true
secret-files: |
"secrets_env=./secrets.env"
tags: ${{ steps.meta-solr.outputs.tags }}
labels: ${{ steps.meta-solr.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
# _2:
# needs: [setup_workflow_env]
_3:
needs: [setup_workflow_env, _1]
uses: SSHOC/gl-autodevops-minimal-port/.github/workflows/deploy-cluster-2.yml@main
secrets: inherit
with:
environment: ${{ needs.setup_workflow_env.outputs.environment}}
DOCKER_TAG: ${{ needs.setup_workflow_env.outputs.registry_root }}${{ needs.setup_workflow_env.outputs.image_name }}
APP_NAME: ${{ needs.setup_workflow_env.outputs.APP_NAME }}-${{ needs.setup_workflow_env.outputs.environment_short }}
APP_ROOT: ${{ needs.setup_workflow_env.outputs.APP_ROOT }}
SERVICE_ID: ${{ needs.setup_workflow_env.outputs.SERVICE_ID }}
PUBLIC_URL: ${{ needs.setup_workflow_env.outputs.PUBLIC_URL }}
POSTGRES_ENABLED: ${{ needs.setup_workflow_env.outputs.POSTGRES_ENABLED == 'true'}}
default_port: "${{ needs.setup_workflow_env.outputs.default_port}}"
submodules: ${{ needs.setup_workflow_env.outputs.submodules }}
_3_stage:
needs: [setup_workflow_env, _1]
uses: SSHOC/gl-autodevops-minimal-port/.github/workflows/deploy-cluster-2.yml@main
secrets: inherit
with:
environment: review/stage
do_deploy: ${{ needs.setup_workflow_env.outputs.environment == 'review/develop' }}
DOCKER_TAG: ${{ needs.setup_workflow_env.outputs.registry_root }}${{ needs.setup_workflow_env.outputs.image_name }}
APP_NAME: ${{ needs.setup_workflow_env.outputs.APP_NAME }}-stage
APP_ROOT: ${{ needs.setup_workflow_env.outputs.APP_ROOT }}
SERVICE_ID: ${{ needs.setup_workflow_env.outputs.SERVICE_ID }}
PUBLIC_URL: ${{ needs.setup_workflow_env.outputs.PUBLIC_URL }}
POSTGRES_ENABLED: ${{ needs.setup_workflow_env.outputs.POSTGRES_ENABLED == 'true'}}
default_port: "${{ needs.setup_workflow_env.outputs.default_port}}"
submodules: ${{ needs.setup_workflow_env.outputs.submodules }}