From 0e6b32af3045e91d4daf592bbe1b79525b00704b Mon Sep 17 00:00:00 2001 From: Raphael Schweikert Date: Wed, 16 Oct 2024 17:00:16 +0200 Subject: [PATCH 1/2] ci: configure maven publication --- build.gradle.kts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 100f2cd..2d0b29d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -175,3 +175,27 @@ aem { } } } + +publishing { + repositories { + val mavenPublishUser: String? by project + val mavenPublishPassword: String? by project + if (mavenPublishUser != null && mavenPublishPassword != null) { + maven { + name = "GitHub" + url = uri("https://maven.pkg.github.com/swisscom/JCR-Hopper") + credentials { + username = mavenPublishUser + password = mavenPublishPassword + } + } + } + } + + publications { + create("hopper") { + artifact(tasks.packageCompose) + from(components["java"]) + } + } +} From 0ad4ee88fc0d92e3245e1d0dacad2baf0d60ca0d Mon Sep 17 00:00:00 2001 From: Aoibhe Wilson Date: Wed, 16 Oct 2024 17:12:51 +0200 Subject: [PATCH 2/2] ci(meta): add release and publish actions --- .github/workflows/publish.yml | 30 +++++++++++++++++++++++ .github/workflows/release.yml | 45 +++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..deaf9db --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,30 @@ +name: Publish + +on: + release: + types: + - created + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'zulu' + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + + - uses: gradle/actions/setup-gradle@v4 # v4.0.0 + + - name: Publish to GitHub Packages + run: ./gradlew publish -Prelease.useLastTag=true + env: + ORG_GRADLE_PROJECT_mavenPublishUser: ${{ github.actor }} + ORG_GRADLE_PROJECT_mavenPublishPassword: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d2a4fb8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: Release + +on: + push: + branches: + - main + tags-ignore: + - v[0-9]+.[0-9]+.[0-9]+ + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'zulu' + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + + - uses: gradle/actions/setup-gradle@v4 # v4.0.0 + + - run: ./gradlew check + + - name: Create Changelog and Tag + uses: TriPSs/conventional-changelog-action@v5 + with: + github-token: ${{ secrets.github_token }} + preset: 'conventionalcommits' + output-file: 'docs/CHANGELOG.md' + skip-version-file: 'true' + + - name: Create Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.github_token }} + with: + tag_name: ${{ steps.changelog.outputs.tag }} + release_name: ${{ steps.changelog.outputs.tag }} + body: ${{ steps.changelog.outputs.clean_changelog }}