-
Notifications
You must be signed in to change notification settings - Fork 5
SK-1786 common workflow for internal and public release #137
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
2 commits
Select commit
Hold shift + click to select a range
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 |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| name: Publish package to the JFROG Artifactory | ||
| on: | ||
| push: | ||
| tags: '*.*.*' | ||
| paths-ignore: | ||
| - "pom.xml" | ||
| - "*.md" | ||
| branches: | ||
| - release/* | ||
|
|
||
| jobs: | ||
| build-and-deploy: | ||
| uses: ./.github/workflows/shared-build-and-deploy.yml | ||
| with: | ||
| ref: ${{ github.ref_name }} | ||
| is-internal: true | ||
| server-id: central | ||
| profile: jfrog | ||
| secrets: | ||
| server-username: ${{ secrets.ARTIFACTORY_USERNAME }} | ||
| server-password: ${{ secrets.ARTIFACTORY_PASSWORD }} | ||
| gpg-key: ${{ secrets.JFROG_GPG_KEY }} | ||
| gpg-passphrase: ${{ secrets.JFROG_GPG_PASSPHRASE }} |
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
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,105 @@ | ||
| name: Shared Build and Deploy | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| ref: | ||
| description: 'Git reference to use (e.g., main or branch name)' | ||
| required: true | ||
| type: string | ||
|
|
||
| is-internal: | ||
| description: 'Flag for internal release' | ||
| required: true | ||
| type: boolean | ||
|
|
||
| server-id: | ||
| description: 'Id of the repository' | ||
| required: true | ||
| type: string | ||
|
|
||
| profile: | ||
| description: 'Profile to pick from pom.xml' | ||
| required: true | ||
| type: string | ||
| secrets: | ||
| server-username: | ||
| required: true | ||
|
|
||
| server-password: | ||
| required: true | ||
|
|
||
| gpg-key: | ||
| required: true | ||
|
|
||
| gpg-passphrase: | ||
| required: true | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| with: | ||
| ref: ${{ inputs.ref }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up maven or jfrog repository | ||
| uses: actions/setup-java@v1 | ||
| with: | ||
| java-version: '1.8' | ||
| distribution: 'adopt' | ||
| server-id: ${{ inputs.server-id }} | ||
| server-username: SERVER_USERNAME | ||
| server-password: SERVER_PASSWORD | ||
|
||
| gpg-private-key: ${{ secrets.gpg-key }} # Value of the GPG private key to import | ||
| gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase | ||
|
|
||
| - name: Get Previous tag | ||
| id: previoustag | ||
| uses: WyriHaximus/github-action-get-previous-tag@v1 | ||
| with: | ||
| fallback: 1.0.0 | ||
|
|
||
| - name: Bump Version | ||
| run: | | ||
| chmod +x ./scripts/bump_version.sh | ||
| if ${{ inputs.is-internal }}; then | ||
| ./scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}" "$(git rev-parse --short "$GITHUB_SHA")" | ||
| else | ||
| ./scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}" | ||
| fi | ||
|
|
||
| - name: Commit changes | ||
| run: | | ||
| git config user.name ${{ github.actor }} | ||
| git config user.email ${{ github.actor }}@users.noreply.github.com | ||
| git add pom.xml | ||
| if ${{ inputs.is-internal }}; then | ||
| git commit -m "[AUTOMATED] Private Release ${{ steps.previoustag.outputs.tag }}-dev-$(git rev-parse --short $GITHUB_SHA)" | ||
| git push origin ${{ github.ref_name }} -f | ||
| else | ||
| git commit -m "[AUTOMATED] Public Release - ${{ steps.previoustag.outputs.tag }}" | ||
| git push origin | ||
| fi | ||
|
|
||
| - name: Create env | ||
| if: ${{ inputs.is-internal }} | ||
| id: create-env | ||
| run: | | ||
| touch .env | ||
| echo SKYFLOW_CREDENTIALS=${{ secrets.SKYFLOW_CREDENTIALS }} >> .env | ||
| echo TEST_EXPIRED_TOKEN=${{ secrets.TEST_EXPIRED_TOKEN }} >> .env | ||
|
|
||
| - name: Create credentials json | ||
| id: create-json | ||
| uses: jsdaniell/create-json@1.1.2 | ||
| with: | ||
| name: "credentials.json" | ||
| json: ${{ secrets.TEST_CREDENTIALS_FILE_STRING }} | ||
|
|
||
| - name: Publish package | ||
| run: mvn clean deploy -P ${{ inputs.profile }} | ||
| env: | ||
| SERVER_USERNAME: ${{ secrets.server-username }} | ||
| SERVER_PASSWORD: ${{ secrets.server-password }} | ||
| GPG_PASSPHRASE: ${{ secrets.gpg-passphrase }} | ||
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,40 @@ | ||
| # Input Arguments | ||
| Version=$1 | ||
| CommitHash=$2 | ||
| PomFile="$GITHUB_WORKSPACE/pom.xml" | ||
|
|
||
| if [ -z "$Version" ]; then | ||
| echo "Error: Version argument is required." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Update only the main project's <version> | ||
| if [ -z "$CommitHash" ]; then | ||
| echo "Bumping main project version to $Version" | ||
|
|
||
| awk -v version="$Version" ' | ||
| BEGIN { updated = 0 } | ||
| /<version>/ && updated == 0 { | ||
| sub(/<version>.*<\/version>/, "<version>" version "</version>") | ||
| updated = 1 | ||
| } | ||
| { print } | ||
| ' "$PomFile" > tempfile && cat tempfile > "$PomFile" && rm -f tempfile | ||
|
|
||
| echo "--------------------------" | ||
| echo "Done. Main project version now at $Version" | ||
| else | ||
| echo "Bumping main project version to $Version-dev-$CommitHash" | ||
|
|
||
| awk -v version="$Version-dev.$CommitHash" ' | ||
| BEGIN { updated = 0 } | ||
| /<version>/ && updated == 0 { | ||
| sub(/<version>.*<\/version>/, "<version>" version "</version>") | ||
| updated = 1 | ||
| } | ||
| { print } | ||
| ' "$PomFile" > tempfile && cat tempfile > "$PomFile" && rm -f tempfile | ||
|
|
||
| echo "--------------------------" | ||
| echo "Done. Main project version now at $Version-dev.$CommitHash" | ||
| fi |
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.