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

Added workflows for GitHub Actions and deleted CircleCI config. #170

Merged
merged 3 commits into from
Jul 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 0 additions & 54 deletions .circleci/config.yml

This file was deleted.

291 changes: 291 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@
name: Deploy Release to GitHub and Maven Central

on:
workflow_dispatch:
inputs:
release_type:
description: 'Release Type: major, minor, patch'
required: true
default: 'minor'

env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}

jobs:
validate-input:
runs-on: ubuntu-latest
if: ${{ github.event.inputs.release_type == 'major' ||
github.event.inputs.release_type == 'minor' ||
github.event.inputs.release_type == 'patch' }}
steps:
- name: Release Type selected for making release
run: echo "[${{ github.event.inputs.release_type }}] release in progress."

prepare-release-snapshot:
needs:
- validate-input
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Install Java and Maven
uses: actions/setup-java@v2
with:
java-version: '15'
distribution: 'adopt'

- name: Restore local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ github.sha }}

- name: Maven command to update Major snapshot version
if: ${{ github.event.inputs.release_type == 'major' }}
run: mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.nextMajorVersion}.0.0-SNAPSHOT versions:commit

- name: Maven command to update Minor snapshot version
if: ${{ github.event.inputs.release_type == 'minor' }}
run: mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0-SNAPSHOT versions:commit

- name: Maven command to update Patch snapshot version
if: ${{ github.event.inputs.release_type == 'patch' }}
run: mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT versions:commit

- name: Build the artifacts
run: mvn clean install -DskipTests -Dcheckstyle.skip

- name: Upload target folder
uses: actions/upload-artifact@v2
with:
name: target
path: |
${{ github.workspace }}/target
${{ github.workspace }}/pom.xml

release-snapshot:
runs-on: ubuntu-latest
needs:
- prepare-release-snapshot
steps:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Install Java and Maven
uses: actions/setup-java@v2
with:
java-version: '15'
distribution: 'adopt'

- name: Restore local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ github.sha }}

- name: Download target folder
uses: actions/download-artifact@v2
with:
name: target

- name: Release snapshot to Maven central
uses: samuelmeuli/action-maven-publish@v1
with:
gpg_private_key: ${{ env.GPG_PRIVATE_KEY }}
gpg_passphrase: ${{ env.GPG_PASSPHRASE }}
nexus_username: ${{ env.NEXUS_USERNAME }}
nexus_password: ${{ env.NEXUS_PASSWORD }}
maven_profiles: release
server_id: ossrh
maven_args: --settings ${{ github.workspace }}/setting/settings.xml -DskipTests -Dcheckstyle.skip -B

prepare-release:
needs:
- release-snapshot
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Install Java and Maven
uses: actions/setup-java@v2
with:
java-version: '15'
distribution: 'adopt'

- name: Restore local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ github.sha }}

- name: Download target folder
uses: actions/download-artifact@v2
with:
name: target

- name: Maven command to update Major version
if: ${{ github.event.inputs.release_type == 'major' }}
run: mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.0.0 versions:commit

- name: Maven command to update Minor version
if: ${{ github.event.inputs.release_type == 'minor' }}
run: mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.0 versions:commit

- name: Maven command to update Patch version
if: ${{ github.event.inputs.release_type == 'patch' }}
run: mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion} versions:commit

- name: Build the project
run: mvn clean install -DskipTests -Dcheckstyle.skip

- name: Upload target folder
uses: actions/upload-artifact@v2
with:
name: target
path: |
${{ github.workspace }}/target
${{ github.workspace }}/pom.xml

maven-release:
runs-on: ubuntu-latest
needs:
- prepare-release
steps:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Install Java and Maven
uses: actions/setup-java@v2
with:
java-version: '15'
distribution: 'adopt'

- name: Restore local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ github.sha }}

- name: Download target folder
uses: actions/download-artifact@v2
with:
name: target

- name: Release to Maven central
uses: samuelmeuli/action-maven-publish@v1
with:
gpg_private_key: ${{ env.GPG_PRIVATE_KEY }}
gpg_passphrase: ${{ env.GPG_PASSPHRASE }}
nexus_username: ${{ env.NEXUS_USERNAME }}
nexus_password: ${{ env.NEXUS_PASSWORD }}
maven_profiles: release
server_id: ossrh
maven_args: --settings ${{ github.workspace }}/setting/settings.xml -DskipTests -Dcheckstyle.skip -B

push-pom:
runs-on: ubuntu-latest
needs:
- maven-release
outputs:
release-version: ${{ steps.artifacts.outputs.version }}
steps:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Install Java and Maven
uses: actions/setup-java@v2
with:
java-version: '15'
distribution: 'adopt'

- name: Download target folder
uses: actions/download-artifact@v2
with:
name: target

- name: Get the release version
id: artifacts
run: |
export MVN_VERSION=$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec)
echo "::set-output name=version::$MVN_VERSION"

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v3
with:
gpg-private-key: ${{ env.GPG_PRIVATE_KEY }}
passphrase: ${{ env.GPG_PASSPHRASE }}
git-user-signingkey: true
git-commit-gpgsign: true

- name: Push updated pom.xml
uses: EndBug/add-and-commit@v7
with:
add: pom.xml
message: Released latest version to Maven central
push: true
default_author: user_info
signoff: true

push-tag:
runs-on: ubuntu-latest
needs:
- push-pom
steps:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Download target folder
uses: actions/download-artifact@v2
with:
name: target

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v3
with:
gpg-private-key: ${{ env.GPG_PRIVATE_KEY }}
passphrase: ${{ env.GPG_PASSPHRASE }}
git-user-signingkey: true
git-commit-gpgsign: true

- name: Create and Push Tag
uses: EndBug/add-and-commit@v7
with:
tag: v${{ needs.push-pom.outputs.release-version }}
message: Released to Maven central
signoff: true
default_author: user_info
push: true

github-release:
runs-on: ubuntu-latest
needs:
- push-pom
- push-tag
steps:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Download target folder
uses: actions/download-artifact@v2
with:
name: target

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
with:
body_path: changelogs/latest.md
tag_name: v${{ needs.push-pom.outputs.release-version }}
name: Version ${{ needs.push-pom.outputs.release-version }}
prerelease: false
draft: false
files: |
target/*.jar
target/*.pom
21 changes: 12 additions & 9 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ name: Mark stale issues and pull requests

on:
schedule:
- cron: "30 1 * * *"
- cron: "0 0 * * *"

jobs:
stale:

runs-on: ubuntu-latest

steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'Stale issue message'
stale-pr-message: 'Stale pull request message'
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
- uses: actions/stale@v3
with:
repo-token: ${{ github.token }}
stale-issue-message: 'Ticket is stale since last 90 days.'
stale-pr-message: 'PR is stale since last 90 days'
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
days-before-stale: 90
days-before-close: 120
close-issue-message: 'Ticket is closed since no activity for last 120 days'
close-pr-message: 'PR is closed without merge since last 120 days.'
Loading