Skip to content

chore: Upgrade docker/metadata-action digest to 44d81d6 (#307) #1673

chore: Upgrade docker/metadata-action digest to 44d81d6 (#307)

chore: Upgrade docker/metadata-action digest to 44d81d6 (#307) #1673

name: Docker
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
schedule:
- cron: '15 5 * * *'
push:
branches:
- develop
- main
# Publish semver tags as releases.
tags: ['v*.*.*']
pull_request:
branches: [main]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
M4B_TOOL_DOWNLOAD_LINK: 'https://github.com/sandreas/m4b-tool/files/9721007/m4b-tool.tar.gz'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@7ca345011ac4304463197fac0e56eab1bc7e6af0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@44d81d6d2a5a935e1a481942268529623f1f5ccd
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@5e99dacf67635c4f273e532b9266ddb609b3025a
with:
build-args: M4B_TOOL_DOWNLOAD_LINK=${{ env.M4B_TOOL_DOWNLOAD_LINK }}
file: docker/Dockerfile
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Push updated image to bragibooks
- name: Dispatch to bragibooks
run: |
curl -X POST \
-H "Authorization: Bearer ${{secrets.ACCESS_TOKEN}}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/djdembeck/bragibooks/actions/workflows/docker-publish.yml/dispatches \
-d "{\"ref\": \"${GITHUB_REF##*/}\"}"