Merge pull request #103 from wader/bump-debian-buster-slim-buster-202… #210
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: ci | |
on: | |
push: | |
branches: | |
- '**' | |
tags: | |
- '*' | |
pull_request: | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v2 | |
- | |
name: Helper for custom repo name | |
id: reponame | |
run: | | |
if [ "${DOCKER_REPO}" != "" ]; then | |
echo ::set-output name=DOCKER_REPO::${DOCKER_REPO} | |
else | |
echo ::set-output name=DOCKER_REPO::${{ github.repository }} | |
fi | |
env: | |
DOCKER_REPO: "${{ secrets.DOCKER_REPO }}" | |
- | |
name: Docker meta | |
id: docker_meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ${{ steps.reponame.outputs.DOCKER_REPO }} # list of Docker images to use as base name for tags | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{major}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{version}} | |
type=sha | |
flavor: | | |
latest=false | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- | |
name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build and push master as latest | |
if: github.ref == 'refs/heads/master' | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 | |
push: true | |
tags: mwader/postfix-relay:latest | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
- | |
name: Build and push branch or test PR | |
if: github.ref != 'refs/heads/master' | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} |