Skip to content

chore: Upgrade docker/metadata-action digest to bd26c98 (#306) #1668

chore: Upgrade docker/metadata-action digest to bd26c98 (#306)

chore: Upgrade docker/metadata-action digest to bd26c98 (#306) #1668

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@bd26c982ee2b6c0f9744591c74c527e8a669f72f
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##*/}\"}"