DiscordTickets/.github/workflows/docker.yml

66 lines
1.7 KiB
YAML
Raw Permalink Normal View History

2023-02-15 03:07:29 +02:00
name: Publish Docker image
on:
push:
# branches:
# - 'main'
# tags:
# - 'v*'
2023-02-15 03:07:29 +02:00
pull_request:
branches:
- 'main'
jobs:
push_to_registries:
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
2023-02-15 03:07:29 +02:00
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
2023-02-15 03:07:29 +02:00
- name: Log in to the Container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
2023-02-15 03:07:29 +02:00
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
eartharoid/discord-tickets
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
2023-02-15 03:07:29 +02:00
- name: Build and push Docker images
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
2023-02-15 03:07:29 +02:00
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}