autobrr/.github/workflows/docker.yml
Ludvig Lundgren f961115dac
build: pr upload binary artifacts (#358)
* build: upload artifacts on pr

* build: use head sha for docker revision
2022-07-17 18:55:38 +02:00

53 lines
1.3 KiB
YAML

name: docker
on:
push:
branches:
- "master"
- "develop"
tags:
- 'v*'
pull_request:
permissions:
packages: write
contents: read
jobs:
docker:
name: Build and publish Docker images
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/autobrr/autobrr
- name: Build and publish image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
REVISION=${{ github.event.pull_request.head.sha }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}