Skip to content

Build Docker

Build Docker #11

Workflow file for this run

name: Build Docker
on:
workflow_dispatch:
workflow_run:
workflows:
- Up version
types:
- completed
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/datalens-docs
permissions:
contents: read
packages: write
jobs:
build:
name: docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: get latest tag
id: tag
run: |
git fetch --tags
TAG=$(git tag -l "v*" | sort -V | tail -n 1)
VERSION=$(echo "${TAG}" | sed 's|^v||')
echo "tag: ${TAG}"
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "version: ${VERSION}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: checkout latest tag
run: git checkout ${{ steps.tag.outputs.tag }}
- uses: docker/setup-qemu-action@v3
with:
platforms: 'arm64'
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ steps.tag.outputs.version }}
type=raw,value=latest
- uses: docker/build-push-action@v5.0.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max