Changed code to avoid the deprecation warning #104
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: buildx | |
on: | |
push: | |
pull_request: | |
jobs: | |
buildx: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Prepare | |
id: prepare | |
run: | | |
GHCR_IMAGE=ghcr.io/${GITHUB_REPOSITORY} | |
DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x | |
VERSION=${GITHUB_REF#refs/*/} | |
TAGS="${GITHUB_REPOSITORY}:${VERSION}" | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
TAGS="$TAGS,${GITHUB_REPOSITORY}:latest" | |
fi | |
if [[ $VERSION == "master" ]]; then | |
TAGS="$TAGS,${GITHUB_REPOSITORY}:beta" | |
fi | |
GHCR_TAGS="${GHCR_IMAGE}:${VERSION}" | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
GHCR_TAGS="$GHCR_TAGS,${GHCR_IMAGE}:latest" | |
fi | |
if [[ $VERSION == "master" ]]; then | |
GHCR_TAGS="$GHCR_TAGS,${GHCR_IMAGE}:beta" | |
fi | |
run: echo "platforms=${DOCKER_PLATFORMS}" >> $GITHUB_OUTPUT | |
run: echo "tags=${TAGS}" >> $GITHUB_OUTPUT | |
run: echo "ghcr-tags=${GHCR_TAGS}" >> $GITHUB_OUTPUT | |
- name: Set up QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v3 | |
with: | |
image: tonistiigi/binfmt:latest | |
platforms: all | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
id: buildx | |
# with: | |
# install: true | |
- name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build | |
run: | | |
docker buildx build . | |
- name: Test | |
run: | | |
docker-compose version | |
docker-compose --file docker-compose.test.yml up --exit-code-from sut --timeout 10 --build | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.prepare.outputs.tags }} | |
platforms: ${{ steps.prepare.outputs.platforms }} | |
- name: Docker Hub Description | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
short-description: ${{ github.event.repository.description }} | |