-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AJ-1095: Publish Library and CLI (#3)
* First pass at enabling publish wip * Add readme for publishing process * Add publishing to gradle and GHA * working local publish * Update name for package * Ensure git properties is correctly generated remove git setup for cli * Update name * Publish CLI to artifactory * Remaining TODO * undo downgrading gradle * Add import from library code move snapshot as an addition on publishing Add new command to readme * Update name to action * Upgrade artifactory; set git properties config for CLI * Add instructions for cli upgrade update readme * Add comments update comment * Use re-usable GHA workflows instead of dispatch update name * PR Review * Add alias command * test out new GHA turn off dry run * Add as release branch for testing * try pattern * add slash * bump 0.4.0 * Pull version from git config * Remove -SNAPSHOT from version * revert to v3 * Updated main class declaration and add ability to run cli * Try adding automatic creation of release with CLI jar * [undo before merge] add release job to tag action just for testing fix version * bump 0.4.0 * test * test * bump 0.5.0 * Revert "bump 0.5.0" This reverts commit ff47321. * try using workspace path * test * bump 0.5.0 * test updatea * bump 0.6.0 * try again * variable name * bump 0.7.0 * test * bump 0.8.0 * try release upgrade command * bump 0.9.0 * create and upload files and generate notes * bump 0.10.0 * remove github workspace * bump 0.11.0 * test * bump 0.12.0 * make sure we're checking out the tagged * fix formatting * bump 0.13.0 * Final changes to github actions; revert settings.gradle * Update cli release related code * Update readme for CLI release fix * Fix spotbugs * Update README.md and include distribution in the release * pass output from tag to release-cli * spotbugs fix * Add comment * Add test coverage spotless * Add more info to readme on how to use published resources * Update GHA - fix inputs, outputs * UNDO BEFORE MERGE - undo main wip * Consolidate slack notifications and have single gradlew build call * add workflow dispatch * add back ref * Need secrets inherit in order use secrets in called workflow * test full workflow - undo before merge * Revert "test full workflow - undo before merge" This reverts commit ae5ccc7. * PR Review: Update GitConfiguration * PR Review: Remove workflow_dispatch trigger, Update required secrets * PR Review: Updated command * PR Review: Remove artifact group * update formatting --------- Co-authored-by: bumptagbot <robot@terra.team>
- Loading branch information
Showing
25 changed files
with
429 additions
and
98 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
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Create Github Release with CLI Jar and Distribution | ||
on: | ||
workflow_call: | ||
inputs: | ||
tag: | ||
required: true | ||
type: string | ||
secrets: | ||
BROADBOT_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
release-job: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.tag }} | ||
token: ${{ secrets.BROADBOT_TOKEN }} | ||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: 'gradle' | ||
- name: Build jar with latest tagged version | ||
run: | | ||
./gradlew --build-cache jar assembleDist | ||
- name: Create tagged release with CLI jar | ||
run: gh release create ${{ inputs.tag }} 'cli/build/libs/java-pfb-cli-${{ inputs.tag }}.jar' 'cli/build/distributions/cli-${{ inputs.tag }}.zip' --generate-notes --verify-tag | ||
env: | ||
GH_TOKEN: ${{ secrets.BROADBOT_TOKEN }} |
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
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
4 changes: 4 additions & 0 deletions
4
buildSrc/src/main/groovy/bio.terra.pfb.java-application-conventions.gradle
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
plugins { | ||
id 'bio.terra.pfb.java-common-conventions' | ||
id 'application' | ||
} |
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,14 +1,74 @@ | ||
Current usage of CLI: | ||
First, run "jar" gradle task in cli project. | ||
Java PFB CLI | ||
=== | ||
|
||
## Available Commands | ||
- hello | ||
- getNumber5 | ||
- --version | ||
- --help | ||
|
||
## Local Run and Development | ||
|
||
### Option 1 - Run via Gradle (Suggested workflow) | ||
|
||
Run the following command to build the library and CLI jar and execute a command: | ||
```shell | ||
./gradlew run --args=<command> | ||
``` | ||
|
||
### Option 2: Assemble distribution zip and run | ||
Run the following command to build the library and CLI jar: | ||
```shell | ||
./gradlew :cli:assembleDist | ||
``` | ||
Unzip the distribution | ||
```shell | ||
unzip cli/build/distributions/cli-<VERSION>.zip | ||
``` | ||
Run commands | ||
```shell | ||
./cli-<VERSION>/bin/cli <command> | ||
``` | ||
|
||
### Option 3: Build and run jar | ||
Run the following command to build the library and CLI jar: | ||
```shell | ||
./gradlew :cli:jar | ||
``` | ||
|
||
Then, you can use the CLI with the following command: | ||
```shell | ||
java -cp "cli/build/libs/java-pfb-cli.jar" bio.terra.pfb.JavaPfbCommand <command> | ||
java -jar "cli/build/libs/java-pfb-cli-<VERSION>.jar" <command> | ||
``` | ||
Available Commands: | ||
- hello | ||
- --version | ||
- --help | ||
An alias can be created to simplify this command: | ||
```shell | ||
alias pfb='java -jar "cli/build/libs/java-pfb-cli-<VERSION>.jar"' | ||
``` | ||
Example usage of the alias: | ||
```shell | ||
pfb --version | ||
``` | ||
|
||
# Download and run the CLI | ||
## Option 1 - Run from Jar Downloaded from Github Release | ||
1) Download Jar from latest Github release. | ||
2) Note the location of the downloaded jar and run the jar with the following command: | ||
```shell | ||
java -cp "<PATH-TO-JAR>" bio.terra.pfb.JavaPfbCommand <command> | ||
``` | ||
## Option 2 - Run from Distribution Downloaded from Github Release | ||
1) Download Distribution zip from latest Github release. | ||
2) Unzip the distribution | ||
```shell | ||
unzip <PATH-TO-ZIP>/cli-<VERSION>.zip | ||
``` | ||
3) Note the location of the unzipped distribution and run the CLI with the following command: | ||
```shell | ||
./cli-<VERSION>/bin/cli --version | ||
``` | ||
|
||
## Upgrade the CLI | ||
|
||
Github release containing the CLI jar is automatically generated via Github actions when a change is pushed to main. | ||
|
||
|
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
Oops, something went wrong.