-
Notifications
You must be signed in to change notification settings - Fork 3
Publish library #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wei-qiang
wants to merge
28
commits into
main
Choose a base branch
from
publish-snapshot
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+126
−2
Open
Publish library #18
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
ca142a0
Add jreleaser to enable publishing (snapshots) to maven central
wei-qiang f4cc499
Change workflow to test snapshot dryrun
wei-qiang 3bab159
add -P to deploy command
wei-qiang 3b53a47
change -Pjreleaser.project.version to -Pversion
wei-qiang 45d9c31
Use temp credentials and publish to other groupid
wei-qiang 1ac3ed0
Add stagingRepository
wei-qiang a7fdcab
Add staging-deploy repository
wei-qiang 54087f0
change target to build
wei-qiang 2f2bfa7
Add publish command
wei-qiang 3d5d306
turn on debug logging
wei-qiang d9ce5fd
split up commands
wei-qiang 95a1952
add -Pversion
wei-qiang 0f49ffd
add -Pproject.version
wei-qiang a972591
add -Pproject.version
wei-qiang 593ec84
add -Pjreleaser.project.version
wei-qiang a438297
remove version in build.gradle
wei-qiang a6abfd0
set -Pversion
wei-qiang 8a29426
Add sourcesJar
wei-qiang 126ae12
Revert removal of sourcesJar task
wei-qiang e225d32
Fill pom description
wei-qiang d70cc54
Add more developer details
wei-qiang b58b6ba
remove dryrun tag
wei-qiang 321cf90
Change jreleaser to publish to org.lfenergy.powergridmodel
wei-qiang 9a56b3c
Use correct secrets
wei-qiang b807c9d
Add stagingrepository to release deployment
wei-qiang a86c06a
Only publish when its a release
wei-qiang 85d1145
Remove snapshot, add release environment and create_release input for…
wei-qiang ad72f51
Remove publishing when workflow is triggered manually as it wont crea…
wei-qiang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -7,6 +7,12 @@ name: Java CI with Gradle for library | |
| on: | ||
| push: | ||
| workflow_dispatch: | ||
| inputs: | ||
| create_release: | ||
| type: boolean | ||
| description: Create a release when CI passes | ||
| default: false | ||
| required: true | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
|
|
@@ -51,3 +57,52 @@ jobs: | |
| reuse-compliance: | ||
| name: REUSE Compliance | ||
| uses: ./.github/workflows/reuse-compliance.yml | ||
|
|
||
| publish: | ||
| name: Publish to maven central | ||
| needs: [build-and-test] | ||
| if: github.ref_type == 'tag' | ||
| runs-on: ubuntu-latest | ||
| environment: release | ||
| permissions: | ||
| id-token: write | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this one strictly necessary? |
||
| contents: read | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1 | ||
| with: | ||
| fetch-depth: 1 | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup runtime | ||
| uses: ./.github/actions/setup-runtime | ||
|
|
||
| - name: Cache Gradle | ||
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 #v6.1.0 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/settings.gradle*') }} | ||
|
|
||
| - name: Optimize Gradle | ||
| shell: bash | ||
| run: | | ||
| mkdir -p ~/.gradle | ||
| echo "org.gradle.caching=true" >> ~/.gradle/gradle.properties | ||
| echo "org.gradle.configuration-cache=true" >> ~/.gradle/gradle.properties | ||
|
|
||
| - name: Gradle Release Build | ||
| env: | ||
| JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
|
nitbharambe marked this conversation as resolved.
|
||
| JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} | ||
| JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | ||
| JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVEN_USERNAME }} | ||
| JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | ||
| SANITIZED_TAG: ${{ github.ref_name }} | ||
| run: | | ||
| echo "Performing release Gradle publish for tag: $SANITIZED_TAG" | ||
|
|
||
| ./gradlew clean build publish -Pversion=$SANITIZED_TAG | ||
| ./gradlew jreleaserDeploy -Pversion=$SANITIZED_TAG | ||
This file contains hidden or 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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,7 @@ import javax.inject.Inject | |||||
| plugins { | ||||||
| id 'java' | ||||||
| id 'maven-publish' | ||||||
| id 'org.jreleaser' version '1.26.0' | ||||||
| } | ||||||
|
|
||||||
| interface InjectedExecOps { | ||||||
|
|
@@ -15,7 +16,6 @@ interface InjectedExecOps { | |||||
| } | ||||||
|
|
||||||
| group = 'org-power-grid-model' | ||||||
| version = '1.0-SNAPSHOT' | ||||||
|
|
||||||
| repositories { | ||||||
| mavenCentral() | ||||||
|
|
@@ -268,6 +268,21 @@ sourceSets { | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| tasks.register('sourcesJar', Jar) { | ||||||
| dependsOn(tasks.named('generatePGMBindings')) | ||||||
| from sourceSets.main.java | ||||||
| archiveClassifier.set('sources') | ||||||
| } | ||||||
|
|
||||||
| artifacts { | ||||||
| archives sourcesJar | ||||||
| } | ||||||
|
|
||||||
| java { | ||||||
| withSourcesJar() | ||||||
| withJavadocJar() | ||||||
| } | ||||||
|
|
||||||
| tasks.named('compileJava') { | ||||||
| dependsOn(tasks.named('generatePGMBindings')) | ||||||
| } | ||||||
|
|
@@ -277,10 +292,64 @@ tasks.named('processResources') { | |||||
| } | ||||||
|
|
||||||
| publishing { | ||||||
| repositories { | ||||||
| maven { | ||||||
| url = layout.buildDirectory.dir("staging-deploy") | ||||||
| } | ||||||
| } | ||||||
| publications { | ||||||
| mavenJava(MavenPublication) { | ||||||
| from components.java | ||||||
| artifactId = 'lib-power-grid-model' | ||||||
| groupId = 'org.lfenergy.powergridmodel' | ||||||
| artifactId = 'power-grid-model-ffm' | ||||||
|
|
||||||
| pom { | ||||||
| name = 'power-grid-model-ffm' | ||||||
| description = 'Java package which wraps PGM core shared library' | ||||||
| url = 'https://github.com/PowerGridModel/libpower-grid-model-java' | ||||||
| organization { | ||||||
| name = 'LF Energy' | ||||||
| url = 'https://lfenergy.org' | ||||||
| } | ||||||
| licenses { | ||||||
| license { | ||||||
| name = 'Mozilla Public License, Version 2.0"' | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| url = 'https://www.mozilla.org/en-US/MPL/2.0/' | ||||||
| } | ||||||
| } | ||||||
| developers { | ||||||
| developer { | ||||||
| id = 'contributors' | ||||||
| name = 'Power Grid Model Contributors' | ||||||
| email = 'powergridmodel@lfenergy.org' | ||||||
| url = 'https://github.com/PowerGridModel/libpower-grid-model-java' | ||||||
| } | ||||||
| } | ||||||
| scm { | ||||||
| url = 'https://github.com/PowerGridModel/libpower-grid-model-java' | ||||||
| connection = 'scm:git:git://github.com/PowerGridModel/libpower-grid-model-java.git' | ||||||
| developerConnection = 'scm:git:ssh://git@github.com/PowerGridModel/libpower-grid-model-java.git' | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| jreleaser { | ||||||
| signing { | ||||||
| active = 'ALWAYS' | ||||||
| armored = true | ||||||
| } | ||||||
| deploy { | ||||||
| maven { | ||||||
| mavenCentral { | ||||||
| 'release-deploy' { | ||||||
| active = 'RELEASE' | ||||||
| url = 'https://central.sonatype.com/api/v1/publisher' | ||||||
| stagingRepository('build/staging-deploy') | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.