Skip to content

E2E Build Application Docker #101

E2E Build Application Docker

E2E Build Application Docker #101

on:
workflow_dispatch:
workflow_run:
workflows:
- 'Publish Platform'
- 'Publish Platform Hotfix'
types:
- completed
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
name: E2E Build Application Docker
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
name: datalens-ui
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == '' || github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: read
packages: write
steps:
- name: Download Artifacts
uses: dawidd6/action-download-artifact@v6
if: ${{ github.event.workflow_run.id != '' }}
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
- name: Extract commit ref from workflow
run: |
echo "COMMIT_REF=$(cat workflow_ref/ref || echo '${{ github.ref }}')" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
with:
ref: ${{ env.COMMIT_REF || github.ref }}
- uses: docker/setup-qemu-action@v3
with:
platforms: 'arm64'
- uses: docker/setup-buildx-action@v3
- name: 'Get release build version'
run: |
BUILD_VERSION=$(jq -r '.version' package.json)
COMMIT_NAME=$(git log -n 1 --pretty=format:%s)
echo "Release build version: ${BUILD_VERSION}"
echo "BUILD_VERSION=$BUILD_VERSION" >> "$GITHUB_ENV"
echo "COMMIT_NAME=$COMMIT_NAME" >> "$GITHUB_ENV"
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract tags for Docker
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ env.BUILD_VERSION }}-e2e
- name: Build and push Docker image
uses: docker/[email protected]
with:
build-args: |
app_version=${{ env.BUILD_VERSION }}
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: tests/Dockerfile
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max