Skip to content

Commit

Permalink
fix(ci): create releases with maintained action
Browse files Browse the repository at this point in the history
Also,
 - fix release titles, and
 - pre-compute release notes to avoid unnecessary calls to GitHub API.

refs: #23, #24
  • Loading branch information
reitzig committed Dec 30, 2024
1 parent 95a2a3f commit 10593c3
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 71 deletions.
13 changes: 13 additions & 0 deletions .github/scripts/assemble-release-notes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

set -euo pipefail

image_tag_list="${1}"

# TODO: Include tag annotation?
# TODO: include some form of changelog?

echo -e "### Published images\n"
for tag in $(grep -ve ':latest$' "${image_tag_list}"); do
echo " - [${tag}](https://hub.docker.com/r/${tag%%:*})"
done
57 changes: 0 additions & 57 deletions .github/scripts/update-github-release.sh

This file was deleted.

40 changes: 26 additions & 14 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,32 @@ jobs:
docker push "${tag}"
done <"${IMAGE_TAG_LIST}"
docker logout
- name: Determine version
id: release-version
run: |
tag="${{ github.ref }}"
version="${tag##*/*-}"
is_prerelease=false
title="Release ${version}"
if [[ "${tag}" == *"/pre-"* ]]; then
is_prerelease=true
title="Pre-${title}"
fi
echo "version=${version}" >> $GITHUB_OUTPUT
echo "is_prerelease=${is_prerelease}" >> $GITHUB_OUTPUT
echo "title=${title}" >> $GITHUB_OUTPUT
- name: Assemble release notes
id: release-notes
run: |
.github/scripts/assemble-release-notes.sh \
"${IMAGE_TAG_LIST}" \
> release-notes.md
- name: Create Github release
id: create-gh-release
uses: actions/create-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: ${{ startsWith(github.ref, 'refs/tags/pre-') }}
# TODO: Compute release info before creating the release; communicate by step output
- name: Update Github release info
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
.github/scripts/update-github-release.sh \
"${{ steps.create-gh-release.outputs.id }}"
name: ${{ steps.release-version.outputs.title }}
body_path: release-notes.md
# TODO: mark as draft if created manually
prerelease: ${{ steps.release-version.outputs.is_prerelease }}

0 comments on commit 10593c3

Please sign in to comment.