Skip to content

Commit

Permalink
feat: release mc + api version to github (without build number)
Browse files Browse the repository at this point in the history
  • Loading branch information
acrylic-style committed May 4, 2023
1 parent c5096ab commit dbc3cbf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
# the problem is that the numbers are going to be masked because of the secrets
get_major_version:
runs-on: ubuntu-latest
name: "Get major version"
name: "Get version"
steps:
- uses: actions/checkout@v3
- name: Get major version
Expand Down Expand Up @@ -89,11 +89,14 @@ jobs:
run: './gradlew -PBUILD_NUMBER=$BUILD_NUMBER bakeInstaller --info --stacktrace'
env:
BUILD_NUMBER: ${{ secrets[format('BUILD_NUMBER_{0}', env.MAJOR_VERSION)] }}
- name: Retrieve version
- name: Retrieve mc + api + build number version
run: 'echo "version=$(./gradlew -q --console plain -PBUILD_NUMBER=$BUILD_NUMBER printVersion)" >> $GITHUB_OUTPUT'
id: retrieveVersion
env:
BUILD_NUMBER: ${{ secrets[format('BUILD_NUMBER_{0}', env.MAJOR_VERSION)] }}
- name: Retrieve mc + api version
run: 'echo "version=$(./gradlew -q --console plain printVersion)" >> $GITHUB_OUTPUT'
id: retrieveApiVersion
- name: Release new build
uses: softprops/action-gh-release@v1
with:
Expand All @@ -103,6 +106,15 @@ jobs:
fail_on_unmatched_files: true
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: ${{ !startsWith(github.ref_name, 'ver/') && github.ref_name != 'main' && github.ref_name != 'master' }}
- name: Update release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.retrieveApiVersion.outputs.version }}
files: '*-installer.jar'
target_commitish: ${{ github.sha }}
fail_on_unmatched_files: true
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: ${{ !startsWith(github.ref_name, 'ver/') && github.ref_name != 'main' && github.ref_name != 'master' }}
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
Expand Down
6 changes: 5 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ tasks {
group = "blueberry"

doLast {
println("$MINECRAFT_VERSION-${API_VERSION.replace("-SNAPSHOT", "")}.${getBuildNumber(project)}")
if (project.properties["BUILD_NUMBER"].toString().toLongOrNull() != null) {
println("$MINECRAFT_VERSION-${API_VERSION.replace("-SNAPSHOT", "")}.${getBuildNumber(project)}")
} else {
println("$MINECRAFT_VERSION-${API_VERSION.replace("-SNAPSHOT", "")}")
}
}
}
}
Expand Down

0 comments on commit dbc3cbf

Please sign in to comment.