Skip to content

Commit

Permalink
chore(build_snapshot): publish to github packages
Browse files Browse the repository at this point in the history
  • Loading branch information
ChipWolf committed Dec 16, 2024
1 parent 428808e commit fe12c1c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/build_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4

Expand All @@ -22,7 +25,11 @@ jobs:
run: chmod +x gradlew

- name: Publish
run: ./gradlew publish -Pversion_snapshot -Pmvn.user=${{ secrets.MAVEN_USER }} -Pmvn.key=${{ secrets.MAVEN_TOKEN }} -x test
env:
IS_MAVEN_PUB: true
DEPLOY_TO_GITHUB_PACKAGES_URL: https://maven.pkg.github.com/${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew publish -Pversion_snapshot -x test

- uses: actions/upload-artifact@v4
with:
Expand Down
23 changes: 14 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -272,16 +272,21 @@ gradlePlugin {

publishing {
repositories {
maven {
name = "WagYourMaven"
url = if (project.hasProperty("version_snapshot")) {
URI.create("https://maven.wagyourtail.xyz/snapshots/")
} else {
URI.create("https://maven.wagyourtail.xyz/releases/")
val deployUrl = System.getenv("DEPLOY_TO_GITHUB_PACKAGES_URL")

if (deployUrl != null) {
maven {
name = "GithubPagesMaven"
url = uri(deployUrl)
credentials {
username = System.getenv("GITHUB_ACTOR") ?: ""
password = System.getenv("GITHUB_TOKEN") ?: ""
}
}
credentials {
username = project.findProperty("mvn.user") as String? ?: System.getenv("USERNAME")
password = project.findProperty("mvn.key") as String? ?: System.getenv("TOKEN")
} else {
maven {
name = "BuildDirMaven"
url = uri(layout.buildDirectory.dir("maven").get().asFile)
}
}
}
Expand Down

0 comments on commit fe12c1c

Please sign in to comment.