Skip to content

Make release

Make release #2

Workflow file for this run

name: Make release
on:
workflow_dispatch:
inputs:
tag:
description: "Tag and release name (default: vYYYY.MM.DD)"
required: false
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set tag and release notes
id: meta
env:
INPUT_TAG: ${{ inputs.tag }}
run: |
tag="${INPUT_TAG:-v$(date +%Y.%m.%d)}"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
awk '/^## /{if(n++)exit} n' CHANGELOG.md > "$RUNNER_TEMP/notes.md"
echo "Container image: \`${REGISTRY}/${IMAGE_NAME}:${tag}\`" >> "$RUNNER_TEMP/notes.md"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v7
with:
context: .
file: ./deploy/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Create tag and release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "${{ steps.meta.outputs.tag }}" \
--target "$GITHUB_SHA" \
--notes-file "$RUNNER_TEMP/notes.md"