-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (59 loc) · 2.15 KB
/
release.yml
File metadata and controls
68 lines (59 loc) · 2.15 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
name: Release
on:
push:
tags:
- '*.*.*'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Generate changelog only
id: changelog
uses: mikepenz/release-changelog-builder-action@v4
with:
failOnError: true
outputFile: CHANGELOG.md
configuration: .github/release-config.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Read changelog into output
id: readlog
run: |
CHANGELOG=$(cat CHANGELOG.md)
echo "log<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.readlog.outputs.log }}
prerelease: ${{ contains(github.ref, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set Discord embed color based on release type
id: set_color
run: |
if [[ "${GITHUB_REF##*/}" == *-* ]]; then
echo "color=d29922" >> $GITHUB_OUTPUT
else
echo "color=3eb991" >> $GITHUB_OUTPUT
fi
- name: GitHub Releases to Discord
uses: tsickert/discord-webhook@v7.0.0
with:
webhook-url: ${{ secrets.WEBHOOK_URL }}
content: "<@&1394740955000606902>"
username: "MCR"
avatar-url: "https://avatars.githubusercontent.com/u/220100286"
embed-title: "Release ${{ github.ref_name }}"
embed-url: ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}
embed-description: ${{ steps.readlog.outputs.log }}
embed-timestamp: ${{ github.event.head_commit.timestamp }}
embed-color: ${{ steps.set_color.outputs.color }}
embed-footer-text : "github-actions"
embed-footer-icon-url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
embed-thumbnail-url: "https://avatars.githubusercontent.com/u/220100286"