-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update workflows to publish snapshots
- Loading branch information
1 parent
d22b6e9
commit 07d136e
Showing
4 changed files
with
38 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,110 +2,44 @@ | |
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# 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 | ||
name: Publish | ||
|
||
on: | ||
push: | ||
tags: [ 'releasemain' ] | ||
tags: [ main ] | ||
|
||
jobs: | ||
build: | ||
name: "Publish" | ||
verify: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- name: Get Token | ||
uses: actions/create-github-app-token@v1 | ||
id: app-token | ||
with: | ||
app-id: ${{ secrets.LMOS_COMMITER_APPID }} | ||
private-key: ${{ secrets.LMOS_COMMITER }} | ||
|
||
- name: Checkout main | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: 'main' | ||
fetch-depth: '0' | ||
token: ${{ steps.app-token.outputs.token }} | ||
|
||
- name: Drop release tag | ||
run: git push origin :releasemain | ||
|
||
- uses: actions/checkout@v4 | ||
- name: REUSE Compliance Check | ||
uses: fsfe/reuse-action@v5 | ||
- name: Validate Gradle Wrapper | ||
uses: gradle/actions/[email protected] | ||
|
||
publish: | ||
needs: verify | ||
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' | ||
|
||
- name: Generate versions | ||
uses: HardNorth/[email protected] | ||
with: | ||
version-source: file | ||
version-file: gradle.properties | ||
version-file-extraction-pattern: '(?<=version=).+' | ||
next-version-increment-minor: true | ||
|
||
- name: Validate Gradle | ||
uses: gradle/actions/[email protected] | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/[email protected] | ||
|
||
- name: Git init | ||
run: git config --global user.email "[email protected]" && git config --global user.name "CICD" | ||
|
||
- name: Update version | ||
run: ./gradlew :release -x build -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=${{ env.RELEASE_VERSION }} -Prelease.newVersion=${{ env.NEXT_VERSION }} --no-parallel | ||
cache: 'gradle' | ||
- name: Build with Gradle | ||
run: ./gradlew build | ||
- name: Publish to Maven Central | ||
env: | ||
GITHUB_USER: ${{ github.actor }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Checkout release tag | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ env.RELEASE_VERSION }} | ||
fetch-depth: '0' | ||
|
||
- name: Publish release | ||
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache | ||
env: | ||
GITHUB_USER: ${{ github.actor }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }} | ||
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEY }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYPASSWORD }} | ||
|
||
- name: "Create release info" | ||
uses: "actions/github-script@v7" | ||
with: | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
script: | | ||
try { | ||
const response = await github.rest.repos.createRelease({ | ||
draft: false, | ||
generate_release_notes: true, | ||
name: process.env.RELEASE_VERSION, | ||
owner: context.repo.owner, | ||
prerelease: false, | ||
repo: context.repo.repo, | ||
tag_name: process.env.RELEASE_VERSION, | ||
}); | ||
core.exportVariable('RELEASE_ID', response.data.id); | ||
core.exportVariable('RELEASE_UPLOAD_URL', response.data.upload_url); | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} | ||
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }} | ||
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.GPG_SUBKEY_ID }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_PRIVATE_KEY }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_PASSPHRASE }} | ||
run: ./gradlew publishAllPublicationsToMavenCentralRepository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,33 +2,22 @@ | |
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# 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 Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | ||
|
||
name: Java CI with Gradle | ||
|
||
on: [ push ] | ||
|
||
jobs: | ||
reuse-compliance-check: | ||
verify: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: REUSE Compliance Check | ||
uses: fsfe/reuse-action@v5 | ||
|
||
validation: | ||
name: "Gradle wrapper validation" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- uses: gradle/actions/[email protected] | ||
- name: Validate Gradle Wrapper | ||
uses: gradle/actions/[email protected] | ||
|
||
build: | ||
needs: verify | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
|
@@ -39,23 +28,23 @@ jobs: | |
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 | ||
- name: Build with Gradle Wrapper | ||
cache: 'gradle' | ||
- name: Build with Gradle | ||
run: ./gradlew build | ||
|
||
dependency-submission: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
if: github.ref == 'refs/heads/main' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. | ||
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md | ||
cache: 'gradle' | ||
- name: Generate and submit dependency graph | ||
uses: gradle/actions/dependency-submission@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 | ||
uses: gradle/actions/dependency-submission@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
kotlin.code.style=official | ||
version=0.3.0-SNAPSHOT | ||
version=0.1.0-SNAPSHOT |