Skip to content

Commit f810d2b

Browse files
Create ATC-Flow.yml
1 parent ed875c6 commit f810d2b

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

.github/workflows/ATC-Flow.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build and Release Bukkit Plugin
2+
permissions:
3+
contents: write
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
branches:
11+
- main
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v2
20+
21+
- name: Set up JDK
22+
uses: actions/setup-java@v2
23+
with:
24+
java-version: '21'
25+
distribution: 'adopt'
26+
27+
- name: Build with Maven
28+
run: mvn clean package
29+
30+
- name: Archive artifacts
31+
if: success()
32+
uses: actions/upload-artifact@v3
33+
with:
34+
name: bukkit-plugin
35+
path: target/*.jar
36+
37+
- name: Create release notes
38+
run: |
39+
mkdir -p ./.release_files
40+
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
41+
echo -e "Commit message:\n\`\`\`\n$COMMIT_MESSAGE\n\`\`\`" > ./.release_files/release_notes.txt
42+
COMMIT_HASH=$(git rev-parse HEAD)
43+
echo "Commit hash: $COMMIT_HASH" >> ./.release_files/release_notes.txt
44+
HITOKOTO=$(curl https://v1.hitokoto.cn/?encode=text)
45+
echo -e "\n---\n $HITOKOTO \n\n AutoPackageAction By [@AmethystCraft-DevTeam](https://github.com/AmethystCraft-DevTeam) [@Starry-Sky-World](https://github.com/Starry-Sky-World)" >> ./.release_files/release_notes.txt
46+
47+
- name: Create timestamp
48+
id: vars
49+
run: echo "RELEASE_TAG=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
50+
51+
- name: Configure git user
52+
run: |
53+
git config --global user.name "github-actions[bot]"
54+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
55+
56+
- name: Install GitHub CLI
57+
run: |
58+
sudo apt-get install -y gh
59+
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
60+
61+
- name: Create and push release
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
run: |
65+
tag_name=${{ env.RELEASE_TAG }}
66+
release_name="Auto Package $tag_name"
67+
gh release create $tag_name --title "$release_name" --notes-file ./.release_files/release_notes.txt target/*.jar

0 commit comments

Comments
 (0)