Skip to content

v2.13.1

v2.13.1 #53

name: Build and Push Docker Image
on:
release:
types: [published]
workflow_dispatch:
inputs:
ref_name:
description: "The ref the image should be built for. This is usually the tag of the release."
required: true
type: string
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
pull-requests: write
steps:
- name: Set tag name
run: echo "TAG_NAME=${{ inputs.ref_name || github.ref_name }}" >> $GITHUB_ENV
- name: Checkout Repo
uses: actions/checkout@v4
with:
ref: ${{ env.TAG_NAME }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push builder image
uses: docker/build-push-action@v5
with:
file: Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ env.TAG_NAME }}
- name: Update version in README
run: |
sed -i 's|image: ghcr.io/rmehner/bits-to-dead-trees:v.*|image: ghcr.io/rmehner/bits-to-dead-trees:${{ env.TAG_NAME }}|' README.md
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: "🤖 Update version of docker image in README to ${{ env.TAG_NAME }}"
title: "🤖 Update version in README after release"
base: main
body: |
Updates the referenced docker image version in the README to ${{ env.TAG_NAME }}