Skip to content

Commit

Permalink
Fix workflow building of releases
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmeow committed Nov 26, 2019
1 parent c2b40e9 commit 8e874e8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/gradle-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ jobs:
id: build
env:
USE_ALPHAS: false
run: ./gradlew build
run: ./gradlew setupGithubActions build
- name: Create a Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_name: betteranimalsplus-${{ github.ref }}
tag_name: ${{ github.ref }}
release_name: betteranimalsplus-${{ steps.build.outputs.version }}
draft: false
prerelease: false
- name: Upload Release Asset
Expand All @@ -39,19 +40,19 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/libs/betteranimalsplus-${{ github.ref }}.jar
asset_name: betteranimalsplus-${{ github.ref }}.jar
asset_path: build/libs/betteranimalsplus-${{ steps.build.outputs.version }}.jar
asset_name: betteranimalsplus-${{ steps.build.outputs.version }}.jar
asset_content_type: application/java-archive
- name: Build Success
id: build-success
uses: itsmeow/webhook-action@master
env:
WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
data: "{\"embeds\":[{\"title\":\"Release Build\",\"url\":\"${{ steps.create_release.outputs.html_url }}\",\"description\":\"Branch: ${{ github.event[0].base.ref }}\nTag: ${{ github.ref }}\nStatus: Successful\",\"color\":65280,\"author\":{\"name\":\"${{ github.event[0].user.login }}\",\"url\":\"${{ github.event[0].user.html_url }}\",\"icon_url\":\"${{ github.event[0].user.avatar_url }}\"}}]}"
data: "{\"embeds\":[{\"title\":\"Release Build\",\"url\":\"${{ steps.create_release.outputs.html_url }}\",\"description\":\"Branch: ${{ github.event[0].base.ref }}\\nTag: ${{ steps.build.outputs.version }}\\nStatus: Successful\",\"color\":65280,\"author\":{\"name\":\"${{ github.event.user.login }}\",\"url\":\"${{ github.event.user.html_url }}\",\"icon_url\":\"${{ github.event.user.avatar_url }}\"}}]}"
- name: Build Fail
id: build-fail
if: failure()
uses: itsmeow/webhook-action@master
env:
data: "{\"embeds\":[{\"title\":\"Release Build\",\"url\":\"${{ steps.create_release.outputs.html_url }}\",\"description\":\"Branch: ${{ github.event[0].base.ref }}\nTag: ${{ github.ref }}\nStatus: Failed\",\"color\":16711680,\"author\":{\"name\":\"${{ github.event[0].user.login }}\",\"url\":\"${{ github.event[0].user.html_url }}\",\"icon_url\":\"${{ github.event[0].user.avatar_url }}\"}}]}"
data: "{\"embeds\":[{\"title\":\"Release Build\",\"url\":\"${{ steps.create_release.outputs.html_url }}\",\"description\":\"Branch: ${{ github.event[0].base.ref }}\\nTag: ${{ steps.build.outputs.version }}\\nStatus: Failed\",\"color\":16711680,\"author\":{\"name\":\"${{ github.event.user.login }}\",\"url\":\"${{ github.event.user.html_url }}\",\"icon_url\":\"${{ github.event.user.avatar_url }}\"}}]}"
WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
8 changes: 7 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@ if(System.getenv('USE_ALPHAS').equals('true')) {
}
}
} else {
task setupGithubActions() {}
task setupGithubActions() {
doLast {
exec {
commandLine "echo", "##[set-output name=version;]${project.version}";
}
}
}
version = "${project.mc_version}-${project.mod_version}"
}

Expand Down

0 comments on commit 8e874e8

Please sign in to comment.