-
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (58 loc) · 2.43 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
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Release
on:
push:
branches: [ "1.16-releae", "1.18-release", "1.19-release", "1.20-release", "1.21-release" ]
paths:
- 'src/**'
- 'test/**'
- build.gradle
- gradle.properties
- settings.gradle
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version-file: '.java-version'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build and test
env:
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
MODRINTH_API_KEY: ${{ secrets.MODRINTH_API_KEY }}
run: |
./gradlew curseforge modrinth --console=verbose
- name: Commit hash file and reset changelog
run: |
git config --global user.email "[email protected]"
git config --global user.name "SweetRPG CI"
branch_version=$(echo ${{ github.ref_name }} | cut -f1 -d-)
echo "${{ github.sha }}" > .release-info/${branch_version}/RELEASE_HASH
git add .release-info/${branch_version}/RELEASE_HASH
git commit -m "Update ${branch_version} RELEASE_HASH"
version=$(cat .release-info/${branch_version}/VERSION)
git tag "release-${version}"
echo "# $version" > CHANGELOG/${branch_version}/${version}.md
echo "" >> CHANGELOG/${branch_version}/${version}.md
cat CHANGELOG/${branch_version}/current.md >> CHANGELOG/${branch_version}/${version}.md
cat /dev/null > CHANGELOG/${branch_version}/current.md
git add CHANGELOG/${branch_version}
git commit -m "Reset ${branch_version} changelog"
git push origin --tags
git checkout ${branch_version}
git merge ${{ github.ref_name }}
git push origin