Skip to content

chore: cleanup pull request images #39

chore: cleanup pull request images

chore: cleanup pull request images #39

name: Continuous Delivery
on:
push:
branches:
- main
pull_request:
jobs:
build_and_push:
name: Build & Push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Pull Request suffix
run: |
if [ -n "${{ github.event.number }}" ]; then
echo "PR number: ${{ github.event.number }}"
echo "tag=pr-${{ github.event.number }}" >> "$GITHUB_OUTPUT"
else
echo "Not a PR branch"
echo "tag=latest" >> "$GITHUB_OUTPUT"
fi
id: tag
- name: Build and push (latest)
uses: docker/build-push-action@v6
with:
push: true
tags: danonline/autopulse:${{ steps.tag.outputs.tag }}
file: Dockerfile.alpine
cache-from: type=gha
cache-to: type=gha,mode=max
# - name: Build and push (latest-ubuntu)
# uses: docker/build-push-action@v6
# with:
# push: true
# tags: danonline/autopulse:latest-ubuntu
# file: Dockerfile
# cache-from: type=gha
# cache-to: type=gha,mode=max