Skip to content

Build and Push Docker Image #47

Build and Push Docker Image

Build and Push Docker Image #47

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
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: ${{ $TAG_NAME }}

Check failure on line 27 in .github/workflows/build-docker-image-of-release.yml

View workflow run for this annotation

GitHub Actions / Build and Push Docker Image

Invalid workflow file

The workflow is not valid. .github/workflows/build-docker-image-of-release.yml (Line: 27, Col: 16): Unexpected symbol: '$TAG_NAME'. Located at position 1 within expression: $TAG_NAME .github/workflows/build-docker-image-of-release.yml (Line: 41, Col: 17): Unexpected symbol: '$TAG_NAME'. Located at position 1 within expression: $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 }}:${{ $TAG_NAME }}
- name: Update version in README
run: |
sed 's|image: ghcr.io/rmehner/bits-to-dead-trees:v.*|image: ghcr.io/rmehner/bits-to-dead-trees:${{ $TAG_NAME }}|' README.md
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "🤖 Update version in README after release"
branch: main