From a35904e61c7ef9f1bb71aa7cecbad7288f981b73 Mon Sep 17 00:00:00 2001 From: Hleb Ramniou Date: Thu, 29 May 2025 12:46:00 +0200 Subject: [PATCH 1/3] FOUND-2760 Adapted build.gradle.kts for publishing to GitHub Packages --- build.gradle.kts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index b5ed4cc..5e6e53d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -44,6 +44,16 @@ gradlePlugin { publishing { repositories { mavenLocal() + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/eurofunk/sbom-license-plugin") + credentials { + username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME") + password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN") + } + } + } } } From 06e0bda21866d320b14b7710d7a4e27ba9ebf1c1 Mon Sep 17 00:00:00 2001 From: Hleb Ramniou Date: Thu, 29 May 2025 12:47:30 +0200 Subject: [PATCH 2/3] FOUND-2760 Created a simple workflow that publishes to GitHub Packages --- .github/workflows/gradle-publish.yml | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/gradle-publish.yml diff --git a/.github/workflows/gradle-publish.yml b/.github/workflows/gradle-publish.yml new file mode 100644 index 0000000..93ab6bc --- /dev/null +++ b/.github/workflows/gradle-publish.yml @@ -0,0 +1,44 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created +# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle + +name: Gradle Package + +on: + release: + types: [ created ] + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 + + - name: Build with Gradle + run: ./gradlew build + + # The USERNAME and TOKEN need to correspond to the credentials environment variables used in + # the publishing section of your build.gradle + - name: Publish to GitHub Packages + run: ./gradlew publish + env: + USERNAME: ${{ github.actor }} + TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From a4fa8a382c0789a02974e2c1ec0c577c01459f04 Mon Sep 17 00:00:00 2001 From: Hleb Ramniou Date: Wed, 4 Jun 2025 12:05:49 +0200 Subject: [PATCH 3/3] Add how-to-create-github-release.md --- docs/how-to-create-github-release.md | 60 ++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 docs/how-to-create-github-release.md diff --git a/docs/how-to-create-github-release.md b/docs/how-to-create-github-release.md new file mode 100644 index 0000000..4c24806 --- /dev/null +++ b/docs/how-to-create-github-release.md @@ -0,0 +1,60 @@ +# How to Create a Release in GitHub + +## Steps + +1. ### Open the [GitHub Releases Page](https://github.com/Eurofunk/sbom-license-plugin/releases). + +2. ### Click “Draft a New Release” + This opens the release creation form. + +3. ### Fill in the Release Details + + - **Tag version:** + Use an existing tag or create a new one (e.g., `v1.0.0`). + If creating a new tag, choose the target branch (usually `main` or `release`). + + - **Release title:** + A short, descriptive title (e.g., _"Initial Release"_). + + - **Description:** + Write release notes. Include: + - New features + - Bug fixes + - Breaking changes + - Upgrade instructions + - Attach binaries or assets (optional): + + Pre-release checkbox: + - Check this if the release is not stable (e.g., alpha, beta). + +4. ### Publish the Release + Click **"Publish release"** to make it live. + +Read +more: [Managing releases in a repository](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#about-release-management). + +--- +Once a release is published, the [gradle-publish.yml](../.github/workflows/gradle-publish.yml) workflow is executed +automatically. +It builds and publishes the artifacts to the repositories defined in [build.gradle.kts](../build.gradle.kts): + +```kotlin +publishing { + repositories { + mavenLocal() + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/eurofunk/sbom-license-plugin") + credentials { + username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME") + password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN") + } + } + } + } +} +``` + +By default, the published packages can be found +on the [GitHub Packages](https://github.com/orgs/Eurofunk/packages?repo_name=sbom-license-plugin) page. \ No newline at end of file