Skip to content

Timeout added to GitHub actions #24

Timeout added to GitHub actions

Timeout added to GitHub actions #24

Workflow file for this run

name: ci
on:
push:
branches:
- '**'
tags:
- '*'
paths-ignore:
- "README.md"
- "LICENSE"
- ".github/workflows/deploy-dockerhub.yml"
pull_request:
jobs:
docker:
runs-on: ubuntu-latest
timeout-minutes: 2
env:
IMAGE_NAME: postfix-relay
steps:
- name: Checkout
uses: actions/checkout@v4
- 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@v5
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@v3
- name: Build Docker image
run: docker build -t $IMAGE_NAME .
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push master as latest
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v5
with:
context: .
# platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
push: true
tags: ${{ github.repository }}: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@v5
with:
context: .
# 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 }}