mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-11-09 14:23:08 +02:00
58 lines
1.6 KiB
YAML
58 lines
1.6 KiB
YAML
|
name: Publish Docker image
|
||
|
|
||
|
on:
|
||
|
push:
|
||
|
branches:
|
||
|
- 'main'
|
||
|
tags:
|
||
|
- 'v*'
|
||
|
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: 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 }}
|
||
|
|
||
|
- 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 }}
|
||
|
|
||
|
- 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}}
|
||
|
|
||
|
- name: Build and push Docker images
|
||
|
uses: docker/build-push-action@v4
|
||
|
with:
|
||
|
context: .
|
||
|
push: ${{ github.event_name != 'pull_request' }}
|
||
|
tags: ${{ steps.meta.outputs.tags }}
|
||
|
labels: ${{ steps.meta.outputs.labels }}
|