build: run docker release on branches (#130)

This commit is contained in:
Ludvig Lundgren 2022-02-09 19:11:49 +01:00 committed by GitHub
parent fe06363530
commit bdbdab1f18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,8 +2,11 @@ name: docker
on: on:
push: push:
branches:
- "master"
- "develop"
tags: tags:
- '*' - 'v*'
permissions: permissions:
packages: write packages: write
@ -19,24 +22,27 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Get the tag name
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push - name: Extract metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/autobrr/autobrr
- name: Build and publish image
id: docker_build id: docker_build
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
push: true context: .
tags: | push: ${{ github.event_name != 'pull_request' }}
ghcr.io/autobrr/autobrr:${{ env.TAG }} tags: ${{ steps.meta.outputs.tags }}
ghcr.io/autobrr/autobrr:latest labels: ${{ steps.meta.outputs.labels }}
- name: Image digest - name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }} run: echo ${{ steps.docker_build.outputs.digest }}