Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Add script to generate changelog
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Reichl <[email protected]>
  • Loading branch information
thetredev committed Dec 23, 2023
1 parent fd08dfe commit 50bf91c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/build-push-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ jobs:
docker push ${DOCKER_HUB_PREFIX}/${REGISTRY_IMAGE}:${docker_image}-${{ github.ref_name }}
done
# Copied and modified from k0sctl: https://github.com/k0sproject/k0sctl/blob/main/.github/workflows/release.yaml
# Copied and modified from k0sctl: https://github.com/xdeb-org/xdeb-install/blob/main/.github/workflows/release.yml
- name: Add safe git directory
if: ${{ inputs.tag }}
run: git config --global --add safe.directory /__w/steamcmd/*

## Ugly hack to get the tag name
## github.ref gives the full reference like refs.tags.v0.0.1-beta1
- name: Get branch name to draft release
Expand All @@ -90,11 +94,23 @@ jobs:
run: |
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> ${GITHUB_OUTPUT}
- name: Unshallow git history
if: ${{ inputs.tag }}
env:
TAG_NAME: ${{ steps.branch_name.outputs.TAG_NAME }}
run: |
git fetch --unshallow
git checkout ${TAG_NAME}
- name: Generate changelog
if: ${{ inputs.tag }}
run: ./scripts/changelog.sh

- name: Draft release
if: ${{ inputs.tag }}
uses: softprops/action-gh-release@v1
with:
body: "${{ steps.branch_name.outputs.TAG_NAME }}"
body_path: public/changelog.md
tag_name: ${{ steps.branch_name.outputs.TAG_NAME }}
name: ${{ steps.branch_name.outputs.TAG_NAME }}
draft: true # So we can manually edit before publishing
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
public
17 changes: 17 additions & 0 deletions scripts/changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

repository_url="https://github.com/thetredev/steamcmd"

first_tag=$(git tag --sort=-version:refname | head -n 2 | tail -1)
second_tag=$(git tag --sort=-version:refname | head -n 1)

mkdir -p public

echo "## What's Changed" > public/changelog.md

echo >> public/changelog.md
git log ${first_tag}..${second_tag} --pretty=format:"- %s (%h)" >> public/changelog.md
echo >> public/changelog.md
echo >> public/changelog.md

echo "**Full Changelog**: [\`${first_tag}..${second_tag}\`](${repository_url}/compare/${first_tag}..${second_tag})" >> public/changelog.md

0 comments on commit 50bf91c

Please sign in to comment.