Skip to content

Merge branch 'master' into bdu/controllable_version #1353

Merge branch 'master' into bdu/controllable_version

Merge branch 'master' into bdu/controllable_version #1353

Workflow file for this run

name: Publish latest Docker images
on:
push:
release:
types:
- published
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
packages: write
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Set up QEMU
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2.10.0
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Set Docker Image Tag
id: set_names
run: |
if [ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]; then
DOCKER_IMAGE_TAG=$(echo ${GITHUB_REF} | sed -e "s/refs\/tags\///g")
else
DOCKER_IMAGE_TAG="latest"
fi
DOCKER_IMAGE_NAME=ddapm-test-agent
DOCKER_IMAGE_NAME=$(echo ghcr.io/${GITHUB_REPOSITORY}/${DOCKER_IMAGE_NAME} | tr '[:upper:]' '[:lower:]')
DOCKER_IMAGE_NAME_WITH_TAG=$(echo ${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} | tr '[:upper:]' '[:lower:]')
echo "Using image name '$DOCKER_IMAGE_NAME_WITH_TAG'"
echo "image_name=$DOCKER_IMAGE_NAME_WITH_TAG" >> $GITHUB_OUTPUT
- name: Login to Docker
run: docker login -u publisher -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
- name: Docker Build
uses: docker/build-push-action@1104d471370f9806843c095c1db02b5a90c5f8b6 # v3.3.1
with:
push: true
tags: ${{ steps.set_names.outputs.image_name }}
platforms: "linux/amd64,linux/arm64/v8"
context: .
build-and-publish-windows:
runs-on: windows-latest
permissions:
packages: write
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Set Docker Image Tag
id: set_names
shell: pwsh
run: |
if ("${{ startsWith(github.ref, 'refs/tags/') }}" -eq "true") {
$DOCKER_IMAGE_TAG = "${{ github.ref }}".Replace("refs/tags/", "") + "-windows"
} else {
$DOCKER_IMAGE_TAG = "latest-windows"
}
$DOCKER_IMAGE_NAME = "ddapm-test-agent"
$DOCKER_IMAGE_NAME = "ghcr.io/${{ github.repository }}/${DOCKER_IMAGE_NAME}".ToLower()
$DOCKER_IMAGE_NAME_WITH_TAG = "${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}".ToLower()
Write-Host "Using image name '$DOCKER_IMAGE_NAME_WITH_TAG'"
"image_name=$DOCKER_IMAGE_NAME_WITH_TAG" >> $env:GITHUB_OUTPUT
- name: Login to Docker
run: docker login -u publisher -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
- name: Docker Build
shell: pwsh
run: |
docker build -t ${{ steps.set_names.outputs.image_name }} -f ./Dockerfile.windows .
docker push ${{ steps.set_names.outputs.image_name }}