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

[UEXPRESS-1171] Add get-envs to Docker CI workflow #141

Merged
merged 16 commits into from
Aug 20, 2024
Merged
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
34 changes: 32 additions & 2 deletions .github/workflows/docker-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ name: Docker Application CI
on:
workflow_call:
inputs:
NODE_ENV:
environment:
required: false
description: NODE_ENV environment to run in
description: Environment to run CI checks in
type: string
default: development
secrets:
azureCredentials:
required: false

jobs:
build:
Expand All @@ -24,12 +27,39 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Check if azureCredentials is set
run: |
if [ -z "${{ secrets.azureCredentials }}" ]; then
echo "Azure Credentials not set. Skipping Azure Key Vault retrieval."
echo "AZURE_CREDENTIALS_SET=false" >> $GITHUB_ENV
fi

- name: Generate .env file from Azure Key Vaults
if: ${{ env.AZURE_CREDENTIALS_SET != 'false' }}
id: get-envs
uses: Andrews-McMeel-Universal/get-envs@v1
with:
azurecredentials: ${{ secrets.azureCredentials }}
environment: ${{ inputs.environment }}
contentTypes: BuildArg Env
buildArgPredicate: ";"

- name: Insert new line after build arguments
id: insert-new-line
run: |
buildArguments=$(echo "${{ steps.get-envs.outputs.buildArguments }}" | sed 's/^ ; //g' | sed 's/; /\n/g')
echo 'buildArguments<<EOF' >> $GITHUB_ENV
echo "$buildArguments" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV

- name: Docker Build
uses: docker/build-push-action@v5
with:
tags: docker-ci:latest
push: false
load: true
build-args: |
${{ env.buildArguments }}

- name: Get Docker variables from image
run: |
Expand Down
Loading