Expose auth type as ENV #316
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and deploy docker image | |
on: | |
workflow_dispatch: | |
branches: | |
- 'develop' | |
- 'main' | |
- 'releases/*' | |
inputs: | |
push_to_acr: | |
description: Push to ACR? | |
type: boolean | |
default: false | |
push_to_jfrog: | |
description: Push to JFrog? | |
type: boolean | |
default: false | |
pull_request: | |
branches: | |
- 'develop' | |
- 'main' | |
- 'releases/*' | |
jobs: | |
build: | |
runs-on: 'ubuntu-latest' | |
environment: docker-publish | |
env: | |
# these are global secrets - for readonly access to artifactory | |
INTERNAL_USERNAME: ${{ secrets.JFROG_USERNAME }} | |
INTERNAL_PASSWORD: ${{ secrets.JFROG_PASSWORD }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
server-id: jfrog-central | |
server-username: INTERNAL_USERNAME | |
server-password: INTERNAL_PASSWORD | |
- name: Set Timestamp for docker image for development branch | |
if: github.ref == 'refs/heads/develop' | |
run: echo "TIMESTAMP=-$(date +%Y.%m.%d)" >> $GITHUB_ENV | |
- name: Get User Data Store version | |
run: | | |
REVISION=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout` | |
echo "REVISION=$REVISION" >> $GITHUB_ENV | |
- name: Build war | |
run: | | |
mvn -U -DuseInternalRepo=true --no-transfer-progress package | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
install: true | |
- name: Log in to JFrog registry | |
if: inputs.push_to_jfrog == true | |
uses: docker/login-action@v3 | |
with: | |
registry: https://wultra.jfrog.io/ | |
username: ${{ secrets.JFROG_CONTAINER_REGISTRY_USERNAME }} | |
password: ${{ secrets.JFROG_CONTAINER_REGISTRY_PASSWORD }} | |
- name: Log in to Azure registry | |
if: inputs.push_to_acr == true | |
uses: docker/login-action@v3 | |
with: | |
registry: https://powerauth.azurecr.io/ | |
username: ${{ vars.ACR_USERNAME }} | |
password: ${{ secrets.ACR_PASSWORD }} | |
- name: Build and push container image to Azure registry | |
uses: docker/build-push-action@v6 | |
with: | |
push: ${{ inputs.push_to_acr == true || inputs.push_to_jfrog == true }} | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
file: ./Dockerfile | |
tags: | | |
${{ inputs.push_to_acr == true && format('powerauth.azurecr.io/user-data-store:{0}{1}-{2}', env.REVISION, env.TIMESTAMP, github.sha) || '' }} | |
${{ inputs.push_to_jfrog == true && format('wultra.jfrog.io/wultra-docker/user-data-store:{0}{1}-{2}', env.REVISION, env.TIMESTAMP, github.sha) || '' }} | |
- run: echo '### 🚀 Published images' >> $GITHUB_STEP_SUMMARY | |
- if: inputs.push_to_acr == true | |
run: | | |
echo 'powerauth.azurecr.io/user-data-store:${{ env.REVISION }}${{ env.TIMESTAMP }}-${{ github.sha }}' >> $GITHUB_STEP_SUMMARY | |
- if: inputs.push_to_jfrog == true | |
run: echo 'wultra.jfrog.io/wultra-docker/user-data-store:${{ env.REVISION }}${{ env.TIMESTAMP }}-${{ github.sha }}' >> $GITHUB_STEP_SUMMARY |