-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (67 loc) · 2.45 KB
/
release.yml
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
name: ✳️ Release
on:
create:
tags:
- "v*"
jobs:
cross-build-and-release:
runs-on: ubuntu-latest
steps:
- name: 📦 Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 🔍 Get Previous Release Tag
id: previous-release
run: |
LAST_TAG=$(git describe --abbrev=0 --tags ${{ github.ref_name }}~1)
echo "ℹ️ Last Release is $LAST_TAG"
echo "tag=$LAST_TAG" >> $GITHUB_OUTPUT
- name: ✳️ Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
check-latest: true
- name: 🔄 Initialize Go Environment
run: go get -v ./...
- name: ✳️ Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: 🔄 Install NPM Packages
run: |
echo "ℹ️ Installing discord.js..."
npm install discord.js
echo "ℹ️ Installing ts-node..."
npm install ts-node
echo "ℹ️ Installing openai..."
npm install openai
- name: ⚒️ Cross Build All Binaries
run: make cross-build-all
- name: 📝 Generate Changelog
id: changelog
run: |
echo "ℹ️ Generating Changelogs.md and Changes.log ..."
CURRENT_TAG=${{ github.ref_name }}
LAST_TAG=${{ steps.previous-release.outputs.tag }}
BASE_URL=${{ github.event.repository.html_url }}
echo "# Changes" > changelog.md
git log --pretty=format:"* %s%n" $(git merge-base tags/$LAST_TAG HEAD)..HEAD >> changelog.md
git log --pretty=format:"%s%n" $(git merge-base tags/$LAST_TAG HEAD)..HEAD > changes.md
echo "-----" >> changelog.md
echo "[Commits in this release]($BASE_URL/compare/$LAST_TAG...$CURRENT_TAG)" >> changelog.md
shell: bash
- name: 🚀 Create Release
uses: ncipollo/release-action@v1
with:
name: Release ${{ github.ref_name }}
artifacts: "bin/discord-bot/*"
bodyFile: "changelog.md"
- name: 📢 Send Message to Discord
run: |
echo "ℹ️ Sending release message to Discord channel..."
npx ts-node scripts/discord_release_notification.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}