Merge pull request #57 from sweetrpg/1.20 #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: [ "1.18-release", "1.19-release", "1.20-release", "1.16-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: Build with Gradle | |
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7 | |
env: | |
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }} | |
MODRINTH_API_KEY: ${{ secrets.MODRINTH_API_KEY }} | |
with: | |
arguments: 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 |