-
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.
JNG-3176 Update workflow and .xml files (#3)
* JNG-3176 Update workflow and .xml files * JNG-3176 Update build.yml * JNG-3176 update build
- Loading branch information
1 parent
3825609
commit 1f61b60
Showing
22 changed files
with
1,425 additions
and
491 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
name: java CI with maven | ||
|
||
on: | ||
push: | ||
branches: [ develop ] | ||
pull_request: | ||
branches: [ develop, master, increment/*, release/* ] | ||
|
||
jobs: | ||
build: | ||
name: Build, test and deploy artifacts | ||
runs-on: judong | ||
timeout-minutes: 30 | ||
env: | ||
SIGN_KEY_ID: ${{ secrets.GPG_KEYNAME }} | ||
SIGN_KEY_PASS: ${{ secrets.GPG_PASSPHRASE }} | ||
SIGN_KEY: ${{ secrets.GPG_SECRET_KEYS }} | ||
outputs: | ||
version: ${{ steps.version.outputs.version }} | ||
|
||
steps: | ||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
run: echo "$GITHUB_CONTEXT" | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Project context | ||
id: context | ||
uses: zero88/gh-project-context@v1.1 | ||
|
||
- name: Print git references | ||
run: |- | ||
echo "Ref: ${{ github.ref }}" | ||
echo "Head ref: ${{ github.head_ref }}" | ||
echo "Base ref: ${{ github.base_ref }}" | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'zulu' | ||
|
||
- name: Get the current PR number | ||
uses: jwalton/gh-find-current-pr@v1 | ||
id: current-pr | ||
with: | ||
state: open | ||
|
||
- name: Calculate version number | ||
id: version | ||
run: |- | ||
POM_VERSION=$(./mvnw org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dtycho.mode=maven -DskipModules=true -Dexpression=project.version -q -DforceStdout) | ||
if [[ "${{ github.base_ref }}" == "master" ]]; then | ||
BASE_VERSION=${POM_VERSION} | ||
VERSION_NUMBER=${BASE_VERSION} | ||
else | ||
BASE_VERSION=$(echo "${POM_VERSION}" | cut -d'-' -f 1) | ||
TAG_NAME=$(echo "${{ steps.context.outputs.branch }}" | cut -d ' ' -f2 | tr '#\/\.-' '_') | ||
VERSION_NUMBER=${BASE_VERSION}.$(date +%Y%m%d_%H%M%S)_${{ steps.context.outputs.shortCommitId }}_${TAG_NAME//[(\)]} | ||
fi | ||
echo "Version from POM: ${POM_VERSION}" | ||
echo "Base version from POM: ${BASE_VERSION}" | ||
echo "Building version: ${VERSION_NUMBER}" | ||
echo "::set-output name=version::${VERSION_NUMBER}" | ||
- name: Remove settings.xml | ||
run: rm $HOME/.m2/settings.xml || true | ||
|
||
- name: Setup maven settings.xml | ||
uses: whelk-io/maven-settings-xml-action@v20 | ||
with: | ||
servers: > | ||
[ | ||
{ | ||
"id": "judong-nexus-mirror", | ||
"username": "${{ secrets.JUDONG_NEXUS_USERNAME }}", | ||
"password": "${{ secrets.JUDONG_NEXUS_PASSWORD }}" | ||
}, | ||
{ | ||
"id": "judong-nexus-distribution", | ||
"username": "${{ secrets.JUDONG_NEXUS_USERNAME }}", | ||
"password": "${{ secrets.JUDONG_NEXUS_PASSWORD }}" | ||
} | ||
] | ||
mirrors: > | ||
[ | ||
{ | ||
"id": "judong-nexus-mirror", | ||
"mirrorOf": "*", | ||
"url": "https://nexus.judo.technology/repository/maven-judong/" | ||
} | ||
] | ||
# Phase 1 - Build and deploy to judong nexus | ||
- name: Build with Maven (build, test) | ||
run: |- | ||
./mvnw -B -Dstyle.color=always \ | ||
-Drevision=${{ steps.version.outputs.version }} \ | ||
-Psign-artifacts \ | ||
-Prelease-judong \ | ||
deploy | ||
# For maven central repository release | ||
- name: Deploy with Maven (central) | ||
if: ${{ always() && contains(github.head_ref, 'release') && job.status == 'success' }} | ||
run: |- | ||
./mvnw -B -Dstyle.color=always \ | ||
-Drevision=${{ steps.version.outputs.version }} \ | ||
-DdeployOnly \ | ||
-P"release-central,sign-artifacts" \ | ||
-Dmaven.test.skip=true \ | ||
deploy | ||
- name: Create version tag | ||
uses: actions/github-script@v5 | ||
with: | ||
github-token: ${{ secrets.OSS_PAT }} | ||
script: | | ||
github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: 'refs/tags/v${{ steps.version.outputs.version }}', | ||
sha: context.sha | ||
}) | ||
- name: Tag to trigger PR merge on increment / release branch | ||
if: |- | ||
${{ always() && | ||
(contains(github.head_ref, 'increment') || contains(github.head_ref, 'release')) && | ||
job.status == 'success' }} | ||
uses: actions/github-script@v5 | ||
with: | ||
github-token: ${{ secrets.OSS_PAT }} | ||
script: | | ||
github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: 'refs/tags/merge-pr/${{ steps.current-pr.outputs.pr }}', | ||
sha: context.sha | ||
}) | ||
- name: Tag to trigger release on master / develop branch | ||
if: |- | ||
${{ always() && | ||
(contains(github.head_ref, 'develop') || contains(github.ref, 'develop') || | ||
contains(github.head_ref, 'master') || contains(github.ref, 'master')) && | ||
job.status == 'success' }} | ||
uses: actions/github-script@v5 | ||
with: | ||
github-token: ${{ secrets.OSS_PAT }} | ||
script: | | ||
github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: 'refs/tags/create-release/${{ steps.version.outputs.version }}', | ||
sha: context.sha | ||
}) | ||
- name: Create message | ||
id: message | ||
if: ${{ always() }} | ||
run: |- | ||
if [ "${{ job.status }}" == "success" ]; then | ||
message=":check_mark_button: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
message="${message} Version: ${{ steps.version.outputs.version }}" | ||
fi | ||
if [ "${{ job.status }}" == "failure" ]; then | ||
message=":cross_mark: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
fi | ||
if [ "${{ job.status }}" == "canceled" ]; then | ||
message=":cross_mark: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
fi | ||
message="${message} Commit: ${{ steps.context.outputs.commitMsg }}" | ||
message="${message} User: ${{ github.actor }}" | ||
echo "::set-output name=message::${message}" | ||
- name: Write message to file | ||
run: |- | ||
echo "${{ steps.message.outputs.message }}" | ||
echo "${{ steps.message.outputs.message }}" > build.msg | ||
- name: Send message to skype | ||
uses: Eloco/docker-action-send-skype@v2 | ||
if: always() | ||
with: | ||
skype_username: ${{ secrets.SKYPE_USERNAME }} | ||
skype_password: ${{ secrets.SKYPE_PASSWORD }} | ||
skype_ids: 19:0503749da2e44ed9910046678012bdf7@thread.skype | ||
send_msg_path: build.msg |
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,94 @@ | ||
name: Auto create release notes on create-release/<version> tag | ||
on: | ||
push: | ||
tags: | ||
- create-release/* | ||
jobs: | ||
create_release: | ||
name: Create release notes on create-release/<version> tag | ||
runs-on: judong | ||
timeout-minutes: 5 | ||
steps: | ||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
run: echo "$GITHUB_CONTEXT" | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Project context | ||
id: context | ||
uses: zero88/gh-project-context@v1.1 | ||
|
||
- name: Print git references | ||
run: |- | ||
echo "Ref: ${{ github.ref }}" | ||
echo "Head ref: ${{ github.head_ref }}" | ||
echo "Base ref: ${{ github.base_ref }}" | ||
- name: Get version and branch | ||
id: version | ||
run: | | ||
version=$(echo ${{ github.ref }} | cut -d/ -f4) | ||
branch=$(echo ${{ github.event.base_ref }} | cut -d/ -f3) | ||
echo "Version: $version" | ||
echo "::set-output name=version::$version" | ||
echo "::set-output name=branch::$branch" | ||
- name: Create release note | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: v${{ steps.version.outputs.version }} | ||
tag: v${{ steps.version.outputs.version }} | ||
generateReleaseNotes: true | ||
draft: false | ||
prerelease: ${{ contains(github.head_ref, 'master') || contains(github.ref, 'master') }} | ||
|
||
- name: Set latest tag | ||
uses: EndBug/latest-tag@latest | ||
with: | ||
tag-name: 'latest_${{ steps.version.outputs.branch }}' | ||
|
||
- name: Delete create-release tag | ||
uses: dev-drprasad/delete-tag-and-release@v0.2.0 | ||
with: | ||
tag_name: 'create-release/${{ steps.version.outputs.version }}' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create message | ||
id: message | ||
if: ${{ always() }} | ||
run: |- | ||
if [ "${{ job.status }}" == "success" ]; then | ||
message=":check_mark_button: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
message="${message} Release notes: https://github.com/${{ github.repository }}/releases/tag/v${{ steps.version.outputs.version }}" | ||
fi | ||
if [ "${{ job.status }}" == "failure" ]; then | ||
message=":cross_mark: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
message="${message} Error create release notes" | ||
fi | ||
if [ "${{ job.status }}" == "canceled" ]; then | ||
message=":cross_mark: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
message="${message} Release notes canceled" | ||
fi | ||
echo "::set-output name=message::${message}" | ||
- name: Write message to file | ||
run: |- | ||
echo "${{ steps.message.outputs.message }}" | ||
echo "${{ steps.message.outputs.message }}" > build.msg | ||
# - name: Send message to skype | ||
# uses: Eloco/docker-action-send-skype@v2 | ||
# if: always() | ||
# with: | ||
# skype_username: ${{ secrets.SKYPE_USERNAME }} | ||
# skype_password: ${{ secrets.SKYPE_PASSWORD }} | ||
# skype_ids: 19:0503749da2e44ed9910046678012bdf7@thread.skype | ||
# send_msg_path: build.msg | ||
|
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,29 @@ | ||
name: Add JIRA description to PR | ||
on: | ||
pull_request: | ||
types: [ opened, edited ] | ||
branches: | ||
- '!release/*' | ||
- '!increment/*' | ||
- '!master' | ||
- '!main' | ||
|
||
jobs: | ||
add-jira-description: | ||
name: Add JIRA description to PR | ||
runs-on: judong | ||
timeout-minutes: 3 | ||
steps: | ||
- name: Enforce Jira Issue Key in Pull Request Title | ||
uses: ryanvade/enforce-pr-title-style-action@v1 | ||
with: | ||
projectKey: 'JNG' | ||
|
||
- uses: cakeinpanic/jira-description-action@v0.3.2 | ||
name: jira-description-action | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
jira-token: ${{ secrets.OSS_JIRA_TOKEN }} | ||
jira-base-url: ${{ secrets.JIRA_BASE_URL }} | ||
skip-branches: '^(production-release|main|master|release\/v\d+)$' | ||
jira-project-key: 'JNG' |
Oops, something went wrong.