Skip to content

Commit 6c0bdce

Browse files
authored
Merge pull request #88 from LordMike/feature/auto-contents
Auto: Updating standardized files
2 parents 1ddff3b + 5bdc1f4 commit 6c0bdce

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Release on Tagged Commits
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
# Allow creating releases
13+
contents: write
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
with:
18+
# We need all tags to diff past tag and this.
19+
# Attempts at fetching just two tags has been futile.
20+
fetch-depth: 0
21+
22+
#- name: Fetch Second Latest Tag
23+
# run: |
24+
# # Avoid fetching *all* tags but just the one before this one (assuming we're running on a latest tag always)
25+
# SECOND_LATEST_TAG_NAME=$(git ls-remote --tags origin | grep -o 'refs/tags/[vV0-9]*\.[0-9]*\.[0-9]*$' | sort -V | tail -n2 | head -n1 | sed 's/refs\/tags\///')
26+
# git fetch origin tag $SECOND_LATEST_TAG_NAME
27+
28+
#- name: Fetch tags
29+
# run: git fetch --depth=1 origin '+refs/tags/*:refs/tags/*'
30+
31+
- name: Get Previous Tag
32+
run: |
33+
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
34+
echo "PREV_TAG=$PREV_TAG" >> $GITHUB_ENV
35+
36+
- name: Generate Release Notes
37+
run: |
38+
COMPARE_LINK="https://github.com/${{ github.repository }}/compare/${{ env.PREV_TAG }}...${{ github.ref_name }}"
39+
40+
echo "**Changes Since Last Release:**" > release.md
41+
echo "[View changes ${{ env.PREV_TAG }}...${{ github.ref_name }}]($COMPARE_LINK)" >> release.md
42+
echo "" >> release.md
43+
echo "**Commits:**" >> release.md
44+
git log --pretty=format:"- %h: %s" ${{ env.PREV_TAG }}...${{ github.ref_name }} >> release.md
45+
46+
- name: Create Release
47+
uses: ncipollo/release-action@v1
48+
with:
49+
bodyFile: release.md

0 commit comments

Comments
 (0)