From e09e7c59c7457980b8e2f164aa7bf907190f0bbf Mon Sep 17 00:00:00 2001 From: Jikoo Date: Mon, 22 Mar 2021 09:42:11 -0400 Subject: [PATCH] Fix release action --- .github/workflows/ci.yml | 14 +++++++------- .github/workflows/release.yml | 2 ++ scripts/generate_changelog.sh | 11 +++++------ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41ddcce..72f4c31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,8 +2,6 @@ name: OpenInv CI on: push: - create: - types: [tag] pull_request_target: jobs: @@ -51,18 +49,20 @@ jobs: release: name: Create Github Release needs: [ build ] - if: github.event_name == 'create' && github.event.ref_type == 'tag' + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest steps: - name: Checkout Code uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set Release Variables + run: bash ./scripts/set_release_env.sh - name: Download Artifacts uses: actions/download-artifact@v2 - - name: Set Release Variables - run: . scripts/set_release_env.sh - - name: Create Release id: create-release uses: softprops/action-gh-release@v0.1.5 @@ -73,4 +73,4 @@ jobs: body: ${{ env.GENERATED_CHANGELOG }} draft: true prerelease: false - files: ./OpenInv.jar + files: ./dist/OpenInv.jar diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8901e47..76eb6d9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,6 +10,8 @@ jobs: steps: - name: Checkout Code uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Set CurseForge Variables run: . scripts/set_curseforge_env.sh diff --git a/scripts/generate_changelog.sh b/scripts/generate_changelog.sh index 8aa0ec7..81cddfb 100644 --- a/scripts/generate_changelog.sh +++ b/scripts/generate_changelog.sh @@ -21,9 +21,6 @@ # Query GitHub for the username of the given email address. # Falls through to the given author name. function lookup_email_username() { - # Ensure fallthrough is set - ${2:?Must provide email and username as parameters, i.e. 'lookup_email_username admin@example.com Admin'} - lookup=$(curl -G --data-urlencode "q=$1 in:email" https://api.github.com/search/users -H 'Accept: application/vnd.github.v3+json' | grep '"login":' | sed -e 's/^.*": "//g' -e 's/",.*$//g') if [[ $lookup ]]; then @@ -45,8 +42,10 @@ function get_minecraft_versions() { echo "${minecraft_versions}" } +previous_tag=$(git describe --tags --abbrev=0 @^) + # Use formatted log to pull authors list -authors_raw=$(git log --pretty=format:"%ae|%an" "$(git describe --tags --abbrev=0 @^)"..@) +authors_raw=$(git log --pretty=format:"%ae|%an" "$previous_tag"..@) readarray -t authors <<<"$authors_raw" # Use associative array to map email to author name @@ -69,7 +68,7 @@ for author in "${authors[@]}"; do done # Fetch actual formatted changelog -changelog=$(git log --pretty=format:"* %s (%h) - %ae" "$(git describe --tags --abbrev=0 @^)"..@) +changelog=$(git log --pretty=format:"* %s (%h) - %ae" "$previous_tag"..@) for author_email in "${!author_data[@]}"; do # Ignore case when matching @@ -80,4 +79,4 @@ done minecraft_versions=$(get_minecraft_versions) -printf "## Supported Minecraft versions\n%s\n\n##Changelog\n%s" "${minecraft_versions}" "${changelog}" +printf "## Supported Minecraft versions\n%s\n\n## Changelog\n%s" "${minecraft_versions}" "${changelog}"