Skip to content

Commit

Permalink
Migrate CI/CD to github workflows/actions.
Browse files Browse the repository at this point in the history
Signed-off-by: Łukasz Dywicki <[email protected]>
  • Loading branch information
splatch committed Oct 30, 2023
1 parent 406e048 commit b2a4cc4
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 28 deletions.
28 changes: 0 additions & 28 deletions .circleci/config.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Maven build

on:
push:
branches: [ "master", "1.0.x" , "1.1.x" , "1.2.x" , "1.3.x" ]
pull_request:
branches: [ "master", "1.0.x" , "1.1.x" , "1.2.x" , "1.3.x" ]

jobs:
build:
permissions:
checks: write
contents: read
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
server-id: sonatype-nexus-snapshots
server-username: CI_DEPLOY_USERNAME
server-password: CI_DEPLOY_PASSWORD
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >-
mvn -B -fae -nsu clean verify
- name: Maven Deploy
if: github.event_name != 'pull_request' && success()
run: |
mvn deploy -Drat.skip=true
env:
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
- name: Upload Test Report
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: "java-test-report"
path: |
**/surefire-reports/TEST-*.xml
**/failsafe-reports/TEST-*.xml
70 changes: 70 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Maven release

on:
workflow_dispatch:
inputs:
releaseVersion:
description: "Release version."
required: true
default: "X.Y.Z"
developmentVersion:
description: "Version to which working copy should be set after release."
required: true
default: "X.Y.Z-SNAPSHOT"
dryRun:
description: "Should release be done in dry-run mode."
required: true
default: "true"

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Setup git
run: |
git config user.email "[email protected]"
git config user.name "ConnectorIO Bot"
git config --global url."https://${BUILD_USER}:${BUILD_TOKEN}@github.com/".insteadOf "[email protected]:"
env:
BUILD_USER: x-access-token
BUILD_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
server-id: sonatype-nexus-staging
server-username: CI_RELEASE_USERNAME
server-password: CI_RELEASE_PASSWORD
gpg-passphrase: GPG_PASSPHRASE
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Maven Prepare Release
run: >-
mvn -B
release:prepare -DpreparationProfiles=release
-DreleaseVersion=${{ inputs.releaseVersion }}
-DdevelopmentVersion=${{ inputs.developmentVersion }}
-DdryRun=${{ inputs.dryRun }}
- name: Maven Perform Release
if: success()
run: >-
mvn -B
release:perform -DreleaseProfiles=release
env:
CI_RELEASE_USERNAME: ${{ secrets.CI_RELEASE_USERNAME }}
CI_RELEASE_PASSWORD: ${{ secrets.CI_RELEASE_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Rollback on failure
if: failure()
run: |
mvn -B release:rollback
echo "You may need to manually delete the git tag, if it was created."

0 comments on commit b2a4cc4

Please sign in to comment.