Skip to content

Update actions/checkout action to v4 #117

Update actions/checkout action to v4

Update actions/checkout action to v4 #117

Workflow file for this run

name: buildx
on:
push:
pull_request:
jobs:
buildx:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- name: Prepare
id: prepare
run: |
DOCKER_IMAGE=erseco/alpine-moodle
DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x
VERSION=${GITHUB_REF#refs/*/}
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
fi
if [[ $VERSION == "master" ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:beta"
fi
echo ::set-output name=platforms::${DOCKER_PLATFORMS}
echo ::set-output name=tags::${TAGS}
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
id: buildx
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
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@v4
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@v2
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKERHUB_PASSWORD }}
# short-description: ${{ github.event.repository.description }}