Skip to content

Commit

Permalink
Update gradle_template.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Oct 29, 2023
1 parent c7b7512 commit 1dae998
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions .github/workflows/gradle_template.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Gradle CI
# https://github.com/MinecraftForge/SharedActions/blob/main/.github/workflows/gradle.yml
name: Gradle publishing CI

on:
workflow_call:
Expand All @@ -9,7 +10,7 @@ on:
type: string
default: "17"
gradle_tasks:
description: "The Gradle tasks to run"
description: "The Gradle task(s) to run"
required: false
type: string
default: "publish"
Expand All @@ -36,22 +37,33 @@ permissions:
contents: read

jobs:
notify-discord-start:
notify-build-start:
name: Build notifications (start)
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: matyrobbrt/actions-tag-versioning@main
name: Calculate version
id: version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: matyrobbrt/action-webhooks@main
name: Send Discord start notification
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
status: 'started'
version: ${{ steps.version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: Sibz/github-status-action@v1
name: Set pending status
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: 'Publishing'
state: 'pending'
description: "Version: ${{ steps.version.outputs.version }}"
target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

gradle:
runs-on: ubuntu-latest
Expand All @@ -63,7 +75,7 @@ jobs:

- name: Make Gradle executable
# language=bash
run: chmod +x ./gradlew
run: chmod +x ./gradlew # Thanks Windows

- name: Setup Java ${{ inputs.java }}
# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#java
Expand All @@ -79,17 +91,28 @@ jobs:
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}

notify-discord-end:
name: Notify Discord (end)
needs: [ "notify-discord-start", "gradle" ]
notify-build-end:
name: Build notifications (end)
needs: [ "notify-build-start", "gradle" ]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- uses: matyrobbrt/action-webhooks@main
name: Send Discord end notification
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ needs.gradle.result }}
version: ${{ needs.notify-discord-start.outputs.version }}
version: ${{ needs.notify-build-start.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: Sibz/github-status-action@v1
name: Set build status
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: 'Publishing'
state: ${{ needs.gradle.result }}
description: "Version: ${{ needs.notify-build-start.outputs.version }}"
target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

0 comments on commit 1dae998

Please sign in to comment.