From d9a4ded13a8263deba169711d4129ae6f71bc7f9 Mon Sep 17 00:00:00 2001 From: Walter Huf Date: Wed, 1 May 2024 19:18:11 -0700 Subject: [PATCH] Try publishing the package to Github --- .github/workflows/build.yml | 2 +- .github/workflows/publish.yml | 34 ++++++++++++++++++++++++++++++++++ build.gradle | 12 +++++++++++- 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9e03bc0..e4285cc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: jobs: unitTest: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout the project uses: actions/checkout@v2 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..02ddd8d --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,34 @@ +on: + push: + tags: '*' + + workflow_dispatch: + inputs: + version: + description: "Version name" + required: true + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout the project + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + + - name: Set release name + run: sed -i "s/^\s+version '.*'/version '${{ github.event.inputs.version }}'/" build.gradle && cat build.gradle + if: ${{ github.event.inputs.version }} + - name: Build the project + run: ./gradlew build --stacktrace + - name: Publish package to Github + run: ./gradlew publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index f5e3a6a..1175884 100644 --- a/build.gradle +++ b/build.gradle @@ -123,10 +123,20 @@ publishing { maven(MavenPublication) { // publish to Jitpack groupId 'io.bimmergestalt' - artifactId 'IDriveConnectKit' + artifactId 'idriveconnectkit' version '0.6' from components.java } } + repositories { + maven { + name = "GitHubPackages" + url = "https://maven.pkg.github.com/BimmerGestalt/IDriveConnectKit" + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } }