-
-
Notifications
You must be signed in to change notification settings - Fork 18
89 lines (76 loc) · 2.55 KB
/
Copy pathtag.yml
File metadata and controls
89 lines (76 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Release
permissions:
contents: read
on:
push:
tags:
- 'v*' # For v1.0, v0.1.0, etc
concurrency:
group: ${{ format('{0}-{1}', github.workflow, github.ref) }}
cancel-in-progress: true
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Common Setup
uses: ./.github/actions/common-setup
- name: Publish with Gradle
run: ./gradlew -Pver=${{ github.ref_name }} release
- name: Upload build results
uses: actions/upload-artifact@v7
with:
name: Release Build
path: ${{ github.workspace }}/build/libs/
- name: Create Release
uses: softprops/action-gh-release@v3
id: release
with:
files: ${{ github.workspace }}/build/libs/*
generate_release_notes: true
name: ${{ format('Release {0}', github.ref_name) }}
prerelease: ${{ contains(github.ref_name, '-rc-') }}
fail_on_unmatched_files: true
draft: true
outputs:
url: ${{ steps.release.outputs.url }}
notify:
name: Send job complete notification
runs-on: ubuntu-latest
needs:
- release
if: always() && vars.DISCORD_WEBHOOK_ID
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Common Setup
uses: ./.github/actions/common-setup
with:
java-version: 21
- name: Retrieve Project Name
run: echo "PROJECT_NAME=$(${{github.workspace}}/gradlew -q printProjectName)" >> $GITHUB_ENV
- name: Notify on success
if: success()
uses: appleboy/discord-action@v1.2.0
with:
webhook_id: ${{ vars.DISCORD_WEBHOOK_ID }}
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
color: "#00FF00"
username: "${{ env.PROJECT_NAME }} Release Bot"
message: >
An ${{ env.PROJECT_NAME }} release draft was deployed by ${{ github.actor }}:
${{ needs.release.outputs.url }}
- name: Notify on failure
if: failure()
uses: appleboy/discord-action@v1.2.0
with:
webhook_id: ${{ vars.DISCORD_WEBHOOK_ID }}
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
color: "#FF0000"
username: "${{ env.PROJECT_NAME }} Release Bot"
message: >
An ${{ env.PROJECT_NAME }} release draft ran by ${{ github.actor }} failed:
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}