Skip to content

Commit

Permalink
chore: switch to using env
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This is a complete recode, features may be missing or different, if there are issues please open an issue on github or contact us about it on discord.
  • Loading branch information
sekwah41 committed Nov 19, 2024
1 parent 7229070 commit 4eb22b4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
environment: release
outputs:
release_created: ${{ steps.release.outputs.release_created }}
upload_url: ${{ steps.release.outputs.upload_url }}
Expand All @@ -28,6 +29,7 @@ jobs:
release-task: [curseforge, discordupload, modrinth]
needs: release-please
runs-on: ubuntu-latest
environment: release
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
run: |
# Build
./gradlew build
./gradlew build discordupload
15 changes: 15 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ allprojects {

apply from: 'env-variables.gradle'

def branch = System.getenv("GITHUB_REF")
def snapshotName = null;
if(branch != null) {
branch = branch.replace('refs/heads/', '')
}

def isRelease = System.getenv("IS_RELEASE") == "true"

def githubSha = System.getenv("GITHUB_SHA")
def shaRef = githubSha != null ? "-${githubSha.substring(0, 8)}" : ""
snapshotName = (branch == null || branch.startsWith("release-please")) ? "SNAPSHOT" : branch

archivesBaseName = "Advanced-Portals"
group = 'com.sekwah.advancedportals'
def versionString = (file('./version.txt').text + (isRelease ? "" : "-${snapshotName}${shaRef}")).replaceAll('\n', '').replaceAll('\r', '')
Expand Down Expand Up @@ -184,3 +196,6 @@ idea {
}
}
}

apply from: 'curse.gradle'
apply from: 'discord.gradle'
5 changes: 0 additions & 5 deletions discord.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ buildscript {

apply from: 'env-variables.gradle'

/** For pre-releases and testers to be able to try the latest commits if they want.
* If the builds start exceeding 8MB then we may want to upload to s3 instead and periodically clear.
* TODO possibly add a task that announces when builds are made?
* Though add a note that it may take a while for Curse to approve the files.
*/
task discordupload {
dependsOn(jar)
doLast {
Expand Down

0 comments on commit 4eb22b4

Please sign in to comment.