Skip to content

Merge pull request #24 from VKCOM/di/add-swagger-docs-route/QA-15376 #25

Merge pull request #24 from VKCOM/di/add-swagger-docs-route/QA-15376

Merge pull request #24 from VKCOM/di/add-swagger-docs-route/QA-15376 #25

Workflow file for this run

#
name: Create and publish a Docker image
on:
push:
branches: ['release', 'master']
tags: ['v1.*','v2.*']
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
- platform: linux/arm64
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/[email protected]
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: vkcompublisher
password: ${{ secrets.DEVTOOLS_GITHUB_TOKEN }}
- name: Log in to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
labels: |
org.opencontainers.image.source=https://github.com/VKCOM/devicehub
org.opencontainers.image.title=DeviceHub
org.opencontainers.image.vendor=VKCOM
org.opencontainers.image.description="${{ github.event.repository.description }}"
org.opencontainers.image.licenses=Apache-2.0
images: |
ghcr.io/vkcom/devicehub
docker.io/vkcom/devicehub
- name: Build Docker image
id: build
uses: docker/build-push-action@v6
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: ${{ matrix.platform }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Prepare
run: |
echo "IMAGE_NAME_LC=${IMAGE_NAME,,}" >> $GITHUB_ENV
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: vkcompublisher
password: ${{ secrets.DEVTOOLS_GITHUB_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
labels: |
org.opencontainers.image.source=https://github.com/VKCOM/devicehub
org.opencontainers.image.title=DeviceHub
org.opencontainers.image.vendor=VKCOM
org.opencontainers.image.description="${{ github.event.repository.description }}"
org.opencontainers.image.licenses=Apache-2.0
images: |
ghcr.io/vkcom/devicehub
docker.io/vkcom/devicehub
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ") | ascii_downcase' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf 'vkcom/devicehub@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect vkcom/devicehub:${{ steps.meta.outputs.version }}
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
username: vkcompublisher
password: ${{ secrets.DEVTOOLS_GITHUB_TOKEN }}
repository: vkcom/devicehub
short-description: ${{ github.event.repository.description }}
enable-url-completion: true