Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 60 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,63 @@ jobs:
- name: Publish to hex.pm
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
run: mix hex.publish --yes
run: mix hex.publish --yes
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: publish
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate changelog
env:
REF_NAME: ${{ github.ref_name }}
run: |
# Get the previous tag
PREV_TAG=$(git describe --abbrev=0 --tags "$(git rev-list --tags --skip=1 --max-count=1)" 2>/dev/null || echo "")

if [ -z "$PREV_TAG" ]; then
RANGE="$REF_NAME"
else
RANGE="$PREV_TAG..$REF_NAME"
fi

# Extract the CHANGELOG.md section for this version (Keep-a-Changelog),
# falling back to commit subjects if the section is missing.
VERSION="${REF_NAME#v}"
if awk -v v="## [$VERSION]" 'found && /^## \[/ {exit} $0 == v {found=1; next} found' CHANGELOG.md > changelog-section.md && [ -s changelog-section.md ]; then
cp changelog-section.md release-notes.md
else
git log --pretty=format:"- %s (%h)" "$RANGE" > release-notes.md
fi

{
echo "## Changes"
echo
git log --pretty=format:"- %s (%h)" "$RANGE"
echo
echo
echo "## Installation"
echo
echo '```elixir'
echo "{:ueberauth_authify, \"~> ${VERSION}\"}"
echo '```'
} >> release-notes.md

echo "----- release-notes.md -----"
cat release-notes.md

- name: Create Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REF_NAME: ${{ github.ref_name }}
run: |
gh release create "$REF_NAME" \
--title "Release $REF_NAME" \
--notes-file release-notes.md
Loading