Skip to content

Commit

Permalink
hhhh pls work
Browse files Browse the repository at this point in the history
  • Loading branch information
owengregson committed Aug 10, 2024
1 parent 8d69fd7 commit 32510bd
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ jobs:
version=$(grep -oP '(?<=mod_version = ).*' gradle.properties)
echo "mod_version=$version" >> $GITHUB_ENV
- name: Get latest release version (including pre-releases)
- name: Get the latest release version (including pre-releases)
id: get_latest_release_version
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
latest_release_version=$(curl -s -H "Authorization: token $GH_TOKEN" \
https://api.github.com/repos/${{ github.repository }}/releases \
| jq -r 'map(select(.prerelease == false and .draft == false)) | sort_by(.created_at) | last | .tag_name')
| jq -r 'map(select(.draft == false)) | sort_by(.created_at) | last | .tag_name')
if [ "$latest_release_version" = "null" ] || [ -z "$latest_release_version" ]; then
echo "No previous release found."
Expand Down Expand Up @@ -68,26 +68,25 @@ jobs:
if: env.build_required == 'true'
run: ./gradlew build --no-daemon

- name: Generate Changelog and Contributors List
- name: Generate Changelog
if: env.build_required == 'true'
id: generate_changelog_contributors
id: generate_changelog
run: |
if [ "${{ env.latest_release_version }}" = "none" ]; then
changelog=$(git log --pretty=format:"- %h - %s")
else
last_release_date=$(curl -s -H "Authorization: token $GH_TOKEN" \
https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ env.latest_release_version }} \
| jq -r '.created_at')
changelog=$(git log --since="$last_release_date" --pretty=format:"- %h - %s")
changelog=$(git log --since="${{ env.last_release_date }}" --pretty=format:"- %h - %s")
fi
# Generate contributors list
contributors=$(git shortlog -sn --since="$last_release_date" | awk '{print NR ". " $2 " (" $1 " commits)"}')
echo "changelog<<EOF" >> $GITHUB_ENV
echo "$changelog" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Generate Contributors List
if: env.build_required == 'true'
id: generate_contributors
run: |
contributors=$(git log --pretty="%an" | sort | uniq -c | sort -rn | awk '{print NR". "$2" - "$1" commits"}')
echo "contributors<<EOF" >> $GITHUB_ENV
echo "$contributors" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
Expand All @@ -99,15 +98,13 @@ jobs:
tag: ${{ env.mod_version }}
name: ${{ env.mod_version }}
body: |
## Release v${{ env.mod_version }}
### Contributors:
## Contributors:
${{ env.contributors }}
### Changelog:
## Changelog:
${{ env.changelog }}
draft: false
prerelease: false
artifacts: ./build/libs/XAT-${{ env.mod_version }}.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 32510bd

Please sign in to comment.