2021-10-30 09:20:03 +02:00
|
|
|
name: Build and Publish
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'main'
|
2021-10-30 09:35:23 +02:00
|
|
|
tags:
|
|
|
|
- 'v*'
|
2021-10-30 09:20:03 +02:00
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
2021-10-30 09:35:23 +02:00
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v3
|
|
|
|
with:
|
|
|
|
images: ghcr.io/${{ github.repository }}
|
|
|
|
|
2021-10-30 09:20:03 +02:00
|
|
|
- name: Login to Github Packages
|
|
|
|
uses: docker/login-action@v1
|
2021-10-30 09:35:23 +02:00
|
|
|
if: github.event_name != 'pull_request'
|
2021-10-30 09:20:03 +02:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Build and push
|
|
|
|
id: docker_build
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
2021-10-30 09:35:23 +02:00
|
|
|
context: .
|
|
|
|
push: ${{ github.event_name != 'pull_request'}}
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|