Skip to content

Commit

Permalink
config 31
Browse files Browse the repository at this point in the history
test 31
  • Loading branch information
alternative-rvb committed Mar 13, 2024
1 parent 8186708 commit a584d92
Showing 1 changed file with 14 additions and 32 deletions.
46 changes: 14 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# /.github/workflows/release.yml

name: Generate Detailed Release Notes and Create Draft Release
name: Generate Release Notes and Create Draft Release

on:
push:
Expand All @@ -12,48 +10,32 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Fetch Latest Changes (Optional)
# This step can be removed if you're sure your default fetch depth retrieves all commits
run: |
git fetch --depth=0 origin
- name: Get Latest Tag Info
id: latest_tag
run: |
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
echo "::set-output name=latest_tag::$latest_tag"
uses: actions/checkout@v2
with:
fetch-depth: 0 # Récupère tout l'historique du dépôt pour obtenir tous les commits

- name: Get Previous Tag (Optional)
id: previous_tag
if: ${{ github.ref != 'refs/heads/main' }} # Only get previous tag for releases, not main branch pushes
- name: Get Latest Commit Info
id: latest_commit
run: |
previous_tag=$(git describe --tags $(git rev-list --tags=$latest_tag --max-count=2 | tail -n 1))
echo "::set-output name=previous_tag::$previous_tag"
echo "::set-output name=commit_hash::$(git log -1 --format='%H')"
echo "::set-output name=commit_message::$(git log -1 --format='%s')"
echo "::set-output name=tag_name::$(git describe --tags --abbrev=0)"
- name: Generate Detailed Changelog Content
- name: Generate Changelog Content
id: generate_changelog
run: |
echo "::group::Generating Changelog"
prev_tag=${{ steps.previous_tag.outputs.previous_tag }}
latest_tag=${{ steps.latest_tag.outputs.latest_tag }}
# Use a format string to structure the changelog
CHANGELOG=$(git log --pretty=format:"** - %s (%cn)" $prev_tag..$latest_tag)
if [[ -z "$CHANGELOG" ]]; then
CHANGELOG="No changes since latest tag."
fi
echo "Generated Changelog: $CHANGELOG"
CHANGELOG=$(git log --pretty=format:"* %s (%cn)")
echo "$CHANGELOG"
echo "::endgroup::"
echo "::set-output name=changelog::$CHANGELOG"
- name: Create Draft Release with Detailed Changelog
- name: Create Draft Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: "**${{ github.repository }} - ${{ steps.latest_tag.outputs.latest_tag }}**" # Clear release name with project name and tag
release_name: ${{ github.event.repository.name }}-${{ steps.latest_commit.outputs.tag_name }}
body: ${{ steps.generate_changelog.outputs.changelog }}
draft: true

0 comments on commit a584d92

Please sign in to comment.