Skip to content
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

AJ-1095: Publish Library and CLI #3

Merged
merged 89 commits into from
Aug 8, 2023
Merged

AJ-1095: Publish Library and CLI #3

merged 89 commits into from
Aug 8, 2023

Conversation

snf2ye
Copy link
Collaborator

@snf2ye snf2ye commented Jul 24, 2023

Background

The goal of this PR is enable publishing of the java-pfb-library and java-pfb-cli.

Included Changes

  1. Updated GHAs
  • Now using reusable workflow instead of outdated workflow-dispatch
  • Added publish action for library publish to artifactory
  • Add action to create release in github that includes CLI jar
  1. Enabled publishing of library
  1. Enabled publishing CLI
  • Version for CLI is pulled from git.properties
  • Release is now automatically created and includes the cli jar (Utilizes github cli: https://cli.github.com/manual/gh_release_create)
    Example:
    (Note: I've since deleted the release in the screen shot below to avoid confusion, as it was just a dummy release.)
image

Note on testing:

I've tested all of the individual actions, but I won't really be able to test them all together until this is merged. There is a small chance for a need for a follow on ticket to fix up the github actions.

library/build.gradle Outdated Show resolved Hide resolved
@snf2ye snf2ye force-pushed the sh-aj-1095-publilsh branch 5 times, most recently from 5132c23 to 3cd63c8 Compare July 25, 2023 16:35
gradlew Outdated Show resolved Hide resolved
@snf2ye snf2ye marked this pull request as ready for review July 25, 2023 16:39
Copy link
Member

@pshapiro4broad pshapiro4broad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments, please feel free to set up a meeting or send me a slack message if you want me to go over the comments in more detail.

cli/build.gradle Outdated Show resolved Hide resolved
cli/publishing.gradle Outdated Show resolved Hide resolved
buildSrc/build.gradle Outdated Show resolved Hide resolved
cli/build.gradle Outdated Show resolved Hide resolved
cli/build.gradle Outdated Show resolved Hide resolved
cli/README.md Outdated Show resolved Hide resolved
Copy link
Member

@pshapiro4broad pshapiro4broad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few more comments, looks OK overall.

@@ -1,9 +1,16 @@
name: Tag
on: workflow_dispatch
on:
workflow_dispatch: {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still called on workflow_dispatch? If not I think you can remove this line.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove it!

Just wanted to note that this trigger enables the "run workflow" button in the GitHub UI. But, I agree, I don't think it's needed for the tag action.
image

Comment on lines +73 to +93
tag:
needs: [ build, unit-tests-and-sonarqube, source-clear ]
uses: ./.github/workflows/tag.yml
if: success() && github.ref == 'refs/heads/main'
secrets: inherit

publish-library:
needs: [ tag ]
uses: ./.github/workflows/publish.yml
if: success() && github.ref == 'refs/heads/main'
secrets: inherit
with:
tag: ${{ needs.tag.outputs.tag }}

release-cli:
needs: [ tag ]
uses: ./.github/workflows/release-cli.yml
secrets: inherit
if: success() && github.ref == 'refs/heads/main'
with:
tag: ${{ needs.tag.outputs.tag }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I commented on this before, but I can't find the comment now. I think all three steps can be run as part of a single job. Something like

  tag-and-release:
    needs: [ unit-tests-and-sonarqube, source-clear ]
    if: success() && github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    steps:
      - name: Tag
        uses: .github/workflows/tag.yml
        secrets: inherit
      - name: Publish library
        uses: .github/workflows/publish.yml
        with:
          tag: ${{ tag.outputs.tag }}
        secrets: inherit
      - name: Release CLI
        uses: .github/workflows/release-cli.yml
        with:
          tag: ${{ tag.outputs.tag }}
        secrets: inherit

Although the yaml lint is complaining about the secrets: inherit lines. Not sure why, to me it looks the same as the examples here: https://docs.github.com/en/actions/using-workflows/reusing-workflows#using-inputs-and-secrets-in-a-reusable-workflow

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, I probably missed that suggestion!

I'd rather keep them as separate jobs. If nothing else, I like the diagram it produces 😀. I also have it so that the published library and publish cli jobs can run at the same time once the tag job completes (not that it saves that much time- they're both quick jobs).
image

.github/workflows/publish.yml Show resolved Hide resolved
cli/build.gradle Show resolved Hide resolved
cli/generators.gradle Outdated Show resolved Hide resolved
library/README.md Outdated Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Aug 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@sonarcloud
Copy link

sonarcloud bot commented Aug 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

85.0% 85.0% Coverage
0.0% 0.0% Duplication

@snf2ye snf2ye merged commit 07300fc into main Aug 8, 2023
9 checks passed
@snf2ye snf2ye deleted the sh-aj-1095-publilsh branch August 8, 2023 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants