-
Notifications
You must be signed in to change notification settings - Fork 3
feat: 187 create mobilitydata maven packages #190
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
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
41faedb
Added an action to extract the version form tags.
jcpitre f615b68
Misc changes
jcpitre ba0a78c
Added temp trigger
jcpitre 0d3cc57
Some corrections.
jcpitre 71cb763
simplify GPG credential passing via environment variables in publish…
jcpitre 7c8c7b7
simplify GPG credential passing via environment variables in publish…
jcpitre b2fcf6a
Suppress Maven download progress, fix shade plugin bug
jcpitre 5a902a2
Suppress Maven download progress output in CI workflows
jcpitre 6ec5f74
exclude META-INF/versions from shaded jar to prevent build failure on…
jcpitre d8f9166
Exclude module-info.class from shaded jar to prevent CI build failure
jcpitre d1100b2
Upgrade maven-shade-plugin to 3.6.2 to fix filtering bug causing CI b…
jcpitre db96a36
Enabled debug for mvn
jcpitre 172f84a
Disable dependency-reduced POM creation to prevent git-versioning ext…
jcpitre dec1db2
Debugging versioning.
jcpitre 468ca9c
add release workflow debug steps to diagnose version resolution issue
jcpitre db80cb7
add verbose versioning debug to release workflow
jcpitre fbfc806
Set release version from git tag using versions:set instead of git ve…
jcpitre 9af1e75
Removed staging step and cleanup
jcpitre 7b2f4ea
Restore maven-git-versioning-extension and add placeholder version gu…
jcpitre 846dbe8
Removed slugified.
jcpitre c56a3c7
Replaced org.entur with org.mobilitydata in package names.
jcpitre ba56d9c
Changed to upload the cli to the release before publishing.
jcpitre 8f64393
Made sure the upload is only done at the root module.
jcpitre 0df5055
Ran mvn prettier.
jcpitre d1bbcc2
Minor corrections.
jcpitre 7b726e1
Modified according to PR comments.
jcpitre 698f7fa
Added a minimal example program that documents hot to use the publish…
jcpitre ca39a53
Added some comments about variables and secrets used by the GH workfl…
jcpitre 34da462
Modified according to PR comments.
jcpitre 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
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 |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| name: Publish Snapshot | ||
| # Required secrets / variables: | ||
| # | ||
| # Secrets are loaded from 1Password when both of the following are set: | ||
| # - secrets.OP_SERVICE_ACCOUNT_TOKEN — 1Password service account token | ||
| # - vars.ONE_PASSWORD_SECRET_REFERENCES — 1Password secret references for the variables below | ||
| # | ||
| # Without 1Password, set these GitHub repository secrets directly as a fallback: | ||
| # - MAVEN_GPG_PRIVATE_KEY — armored GPG private key (used to sign artifacts) | ||
| # - MAVEN_GPG_PASSPHRASE — passphrase for the GPG key | ||
| # - MAVEN_CENTRAL_PORTAL_TOKEN_USERNAME — Maven Central portal token username | ||
| # - MAVEN_CENTRAL_PORTAL_TOKEN_PASSWORD — Maven Central portal token password | ||
|
|
||
| concurrency: | ||
| group: deploy-master | ||
| cancel-in-progress: false | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| workflow_dispatch: # Manual trigger | ||
|
|
||
| env: | ||
| java_version: '17' | ||
| java_distribution: 'zulu' | ||
|
|
||
| jobs: | ||
| publish-snapshot: | ||
| if: "github.event_name == 'workflow_dispatch' || !contains(github.event.head_commit.message, 'ci skip')" | ||
| runs-on: ubuntu-24.04 | ||
| env: | ||
| HAS_1PASSWORD: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN != '' && vars.ONE_PASSWORD_SECRET_REFERENCES != '' }} | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Set up JDK ${{ env.java_version }}-${{ env.java_distribution }} | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| java-version: ${{ env.java_version }} | ||
| distribution: ${{ env.java_distribution }} | ||
| - name: Print Java and Maven versions | ||
| run: mvn --version | ||
| - name: Cache Maven dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.m2/repository | ||
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
| ${{ runner.os }}-maven- | ||
| ${{ runner.os }}- | ||
| - name: Load secrets from 1Password | ||
| if: env.HAS_1PASSWORD == 'true' | ||
| # Pinned to a specific tag for supply-chain safety. Update the tag in gtfs-validator if the action changes. | ||
| uses: MobilityData/gtfs-validator/.github/actions/extract-1password-secret@USED_BY_GBFS_VALIDATOR_JAVA # 7bf2832 | ||
| with: | ||
| OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} | ||
| VARIABLES_TO_EXTRACT: 'MAVEN_GPG_PASSPHRASE, MAVEN_GPG_PRIVATE_KEY, MAVEN_CENTRAL_PORTAL_TOKEN_USERNAME, MAVEN_CENTRAL_PORTAL_TOKEN_PASSWORD' | ||
| ONE_PASSWORD_SECRET_REFERENCES: ${{ vars.ONE_PASSWORD_SECRET_REFERENCES }} | ||
| - name: Load secrets from GitHub secrets (fallback for forks without 1Password) | ||
| if: env.HAS_1PASSWORD != 'true' | ||
| env: | ||
| GPG_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | ||
| GPG_PASS: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | ||
| MVN_USER: ${{ secrets.MAVEN_CENTRAL_PORTAL_TOKEN_USERNAME }} | ||
| MVN_PASS: ${{ secrets.MAVEN_CENTRAL_PORTAL_TOKEN_PASSWORD }} | ||
| run: | | ||
| { | ||
| echo "MAVEN_GPG_PASSPHRASE=$GPG_PASS" | ||
| echo "MAVEN_GPG_PRIVATE_KEY<<GPG_EOF" | ||
| echo "$GPG_KEY" | ||
| echo "GPG_EOF" | ||
| echo "MAVEN_CENTRAL_PORTAL_TOKEN_USERNAME=$MVN_USER" | ||
| echo "MAVEN_CENTRAL_PORTAL_TOKEN_PASSWORD=$MVN_PASS" | ||
| } >> "$GITHUB_ENV" | ||
| - name: Verify version is not placeholder | ||
| run: | | ||
| VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | ||
| if [[ "$VERSION" == *"placeholder"* || "$VERSION" == "0.0.0"* ]]; then | ||
| echo "ERROR: Version is still '$VERSION' — git-versioning extension failed to resolve. Aborting." | ||
| exit 1 | ||
| fi | ||
| echo "Version OK: $VERSION" | ||
| - name: Stage artifacts | ||
| run: mvn deploy -Ppublication -Dprettier.skip=true -ntp | ||
| - name: Publish snapshot to Maven Central | ||
| env: | ||
| JRELEASER_GPG_PASSPHRASE: ${{ env.MAVEN_GPG_PASSPHRASE }} | ||
| JRELEASER_GPG_SECRET_KEY: ${{ env.MAVEN_GPG_PRIVATE_KEY }} | ||
| # -N (non-recursive): run JReleaser only at the root so it uploads a single bundle. | ||
| # Without it, JReleaser runs once per module and the second run fails with "already deployed". | ||
| run: mvn jreleaser:deploy -Djreleaser.output.directory=out -ntp -N | ||
jcpitre marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Upload JReleaser output | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: jreleaser-snapshot-logs | ||
| path: out/ | ||
This file was deleted.
Oops, something went wrong.
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 |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| name: Release | ||
| # Required secrets / variables: | ||
| # | ||
| # Secrets are loaded from 1Password when both of the following are set: | ||
| # - secrets.OP_SERVICE_ACCOUNT_TOKEN — 1Password service account token | ||
| # - vars.ONE_PASSWORD_SECRET_REFERENCES — 1Password secret references for the variables below | ||
| # | ||
| # Without 1Password, set these GitHub repository secrets directly as a fallback: | ||
| # - MAVEN_GPG_PRIVATE_KEY — armored GPG private key (used to sign artifacts) | ||
| # - MAVEN_GPG_PASSPHRASE — passphrase for the GPG key | ||
| # - MAVEN_CENTRAL_PORTAL_TOKEN_USERNAME — Maven Central portal token username | ||
| # - MAVEN_CENTRAL_PORTAL_TOKEN_PASSWORD — Maven Central portal token password | ||
|
|
||
| # Triggered when a GitHub release is published (released). | ||
| # Builds, signs, and publishes all artifacts to Maven Central automatically. | ||
| # The CLI fat jar is also uploaded to the GitHub release assets. | ||
| # | ||
| # The project version is derived from the git tag (e.g. v3.0.0 → 3.0.0) and applied to all | ||
| # modules in-place via versions:set before building. No pom.xml version commits are needed. | ||
| on: | ||
| release: | ||
| types: [released] | ||
|
|
||
| env: | ||
| java_version: '17' | ||
| java_distribution: 'zulu' | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-24.04 | ||
| permissions: | ||
| contents: write | ||
| env: | ||
| HAS_1PASSWORD: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN != '' && vars.ONE_PASSWORD_SECRET_REFERENCES != '' }} | ||
jcpitre marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
| # Check out the exact tagged commit so the version is correctly resolved from the tag. | ||
| ref: ${{ github.event.release.tag_name }} | ||
| - name: Set up JDK ${{ env.java_version }}-${{ env.java_distribution }} | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| java-version: ${{ env.java_version }} | ||
| distribution: ${{ env.java_distribution }} | ||
| - name: Print Java and Maven versions | ||
| run: mvn --version | ||
| - name: Cache Maven dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.m2/repository | ||
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
| ${{ runner.os }}-maven- | ||
| ${{ runner.os }}- | ||
| - name: Load secrets from 1Password | ||
| if: env.HAS_1PASSWORD == 'true' | ||
| # Pinned to a specific tag for supply-chain safety. Update the tag in gtfs-validator if the action changes. | ||
| uses: MobilityData/gtfs-validator/.github/actions/extract-1password-secret@USED_BY_GBFS_VALIDATOR_JAVA # 7bf2832 | ||
| with: | ||
| OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} | ||
| VARIABLES_TO_EXTRACT: 'MAVEN_GPG_PASSPHRASE, MAVEN_GPG_PRIVATE_KEY, MAVEN_CENTRAL_PORTAL_TOKEN_USERNAME, MAVEN_CENTRAL_PORTAL_TOKEN_PASSWORD' | ||
| ONE_PASSWORD_SECRET_REFERENCES: ${{ vars.ONE_PASSWORD_SECRET_REFERENCES }} | ||
jcpitre marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Load secrets from GitHub secrets (fallback for forks without 1Password) | ||
| if: env.HAS_1PASSWORD != 'true' | ||
| env: | ||
| GPG_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | ||
| GPG_PASS: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | ||
| MVN_USER: ${{ secrets.MAVEN_CENTRAL_PORTAL_TOKEN_USERNAME }} | ||
| MVN_PASS: ${{ secrets.MAVEN_CENTRAL_PORTAL_TOKEN_PASSWORD }} | ||
| run: | | ||
| { | ||
| echo "MAVEN_GPG_PASSPHRASE=$GPG_PASS" | ||
| echo "MAVEN_GPG_PRIVATE_KEY<<GPG_EOF" | ||
| echo "$GPG_KEY" | ||
| echo "GPG_EOF" | ||
| echo "MAVEN_CENTRAL_PORTAL_TOKEN_USERNAME=$MVN_USER" | ||
| echo "MAVEN_CENTRAL_PORTAL_TOKEN_PASSWORD=$MVN_PASS" | ||
| } >> "$GITHUB_ENV" | ||
| - name: Set release version from tag | ||
| run: | | ||
| TAG="${{ github.event.release.tag_name }}" | ||
| VERSION="${TAG#v}" | ||
| echo "Setting version: $VERSION" | ||
| mvn --batch-mode -ntp versions:set -DnewVersion="$VERSION" -DprocessAllModules=true -DgenerateBackupPoms=false | ||
| - name: Verify version is not placeholder | ||
| run: | | ||
| VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | ||
| if [[ "$VERSION" == *"placeholder"* || "$VERSION" == "0.0.0"* ]]; then | ||
| echo "ERROR: Version is still '$VERSION' — aborting release." | ||
| exit 1 | ||
| fi | ||
| echo "Version OK: $VERSION" | ||
| - name: Stage artifacts | ||
| run: mvn deploy -Ppublication -Dprettier.skip=true -ntp | ||
| - name: Upload CLI fat jar to GitHub release | ||
| run: | | ||
| gh release upload "${{ github.event.release.tag_name }}" \ | ||
| gbfs-validator-java-cli/target/gbfs-validator-cli.jar \ | ||
| --clobber | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Deploy to Maven Central | ||
| env: | ||
| JRELEASER_GPG_PASSPHRASE: ${{ env.MAVEN_GPG_PASSPHRASE }} | ||
| JRELEASER_GPG_SECRET_KEY: ${{ env.MAVEN_GPG_PRIVATE_KEY }} | ||
| run: mvn jreleaser:deploy -Djreleaser.output.directory=out -ntp -N | ||
| - name: Upload JReleaser output | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: jreleaser-release-logs | ||
| path: out/ | ||
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
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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 https://maven.apache.org/xsd/core-extensions-1.0.0.xsd"> | ||
| <extension> | ||
| <groupId>me.qoomon</groupId> | ||
| <artifactId>maven-git-versioning-extension</artifactId> | ||
| <version>9.11.0</version> | ||
| </extension> | ||
| </extensions> |
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 |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <configuration xmlns="https://github.com/qoomon/maven-git-versioning-extension" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="https://github.com/qoomon/maven-git-versioning-extension | ||
| https://github.com/qoomon/maven-git-versioning-extension/raw/master/src/main/resources/configuration-schema.xsd"> | ||
|
|
||
| <refs> | ||
| <!-- Tagged commit: use the tag version directly (e.g. v2.0.67 → 2.0.67) --> | ||
| <ref type="tag" pattern="v(?<version>.*)"> | ||
| <version>${version}</version> | ||
| </ref> | ||
|
|
||
| <!-- master branch: increment patch and add SNAPSHOT (e.g. after v2.0.66 → 2.0.67-SNAPSHOT) --> | ||
| <ref type="branch" pattern="master"> | ||
| <version>${describe.tag.version.major}.${describe.tag.version.minor}.${describe.tag.version.patch.next}-SNAPSHOT</version> | ||
| </ref> | ||
|
|
||
| <!-- Any other branch: use branch name + SNAPSHOT for local development --> | ||
| <ref type="branch" pattern=".*"> | ||
| <version>${describe.tag.version.major}.${describe.tag.version.minor}.${describe.tag.version.patch.next}-SNAPSHOT</version> | ||
jcpitre marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </ref> | ||
| </refs> | ||
| </configuration> | ||
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
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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| target/ | ||
| .idea/ | ||
| *.iml |
Oops, something went wrong.
Oops, something went wrong.
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.