I use CI/CD in my daily work and would definitely not want to do without it! We have switched all our build jobs to pipelines in the last years, which are part of the code repository. We use Jenkins where pipelines are defined in Jenkinsfile
.
GitHub Actions
Recently I've been looking into GitHub Actions a bit. Besides code management, GitHub also provides a free build infrastructure (GitHub Actions). And I am thrilled. 🤩
With just a few lines, you can easily build and test Ivy projects and throw them into the GitHub package registry (just another free service of GitHub). We have now looked into this more intensively because we want to build the products in our Axon Ivy Market as completely independent Ivy projects.
A-Trust Connector as first example
We use the A-Trust Connector as example to demonstrate this straight away. The A-Trust-Connector is divided into three Ivy projects:
- a-trust-connector: Productive code
- a-trust-connector-demo: Demo projects to show how the a-trust-connector can be used
- a-trust-connector-test: Test project to test the a-trust-connector
With the .github/workflows/ci.yml
in the GitHub repository a very simple CI pipeline can be realized. The file itself should be self-explaining:
name: CI-Build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Java JDK
uses: actions/setup-java@v1.4.3
with:
java-version: 11
- name: Build with Maven
run: mvn clean verify --batch-mode
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: "*/target/surefire-reports/*.xml"
Release Chaos with Maven
Who doesn't know it? Maven and releasing artifacts...😣 Several Maven commands are necessary so that everything really fits. In addition, the correct credentials must be used for pushing into the package registry. In addition, you also want to tag the current code state, which in turn requires other credentials.
GitHub to the rescue
I have never set up a pipeline to release my Maven artifacts so easily. GitHub Actions has a seamless integration for the complete credential handling. Which makes everything as simple as possible. Check out this .github/workflows/release.yml
name: Release-Build
on: workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Java JDK
uses: actions/setup-java@v1.4.3
with:
java-version: 11
server-id: github
- name: Configure Git user
run: |
git config user.email "actions@github.com"
git config user.name "GitHub Actions"
- name: Deploy
run: mvn --batch-mode release:prepare release:perform
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
As this workflow runs on workflow_dispatch
you need to trigger this build by yourself.
https://community.axonivy.com/assets/files/2021-06-14/1623676234-912509-release-on-github.mp4