From 9589f6a63657d8da608e369d84272c59ad362ae1 Mon Sep 17 00:00:00 2001 From: Martin Ledvinka Date: Fri, 7 Jun 2024 10:43:58 +0200 Subject: [PATCH 1/2] [GH-1] Add GH workflows for PR testing and Maven deploy on push to main. --- .github/workflows/deploy-to-maven.yml | 44 ++++++++++++++++++++++ .github/workflows/pull-request-to-main.yml | 29 ++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 .github/workflows/deploy-to-maven.yml create mode 100644 .github/workflows/pull-request-to-main.yml diff --git a/.github/workflows/deploy-to-maven.yml b/.github/workflows/deploy-to-maven.yml new file mode 100644 index 0000000..1717493 --- /dev/null +++ b/.github/workflows/deploy-to-maven.yml @@ -0,0 +1,44 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [ main ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + # Runs a set of commands using the runners shell + - name: Build + run: mvn -B package + + - name: Set up Apache Maven Repository + uses: actions/setup-java@v4 + with: # running setup-java again overwrites the settings.xml + distribution: 'temurin' + java-version: '17' + server-id: akaene # Value of the distributionManagement/repository/id field of the pom.xml + server-username: MAVEN_USERNAME # env variable for username in deploy + server-password: MAVEN_PASSWORD # env variable for password in deploy + + - name: Publish to Apache Maven Central + run: mvn deploy + env: + MAVEN_USERNAME: maven + MAVEN_PASSWORD: ${{ secrets.AKAENE_MAVEN_PASSWORD }} diff --git a/.github/workflows/pull-request-to-main.yml b/.github/workflows/pull-request-to-main.yml new file mode 100644 index 0000000..a1d2fc7 --- /dev/null +++ b/.github/workflows/pull-request-to-main.yml @@ -0,0 +1,29 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + pull_request: + branches: [ main ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'adopt' + + # Runs a set of commands using the runners shell + - name: Test + run: mvn -B test From 58678d2c3eec109e5844c90315d67538ac642086 Mon Sep 17 00:00:00 2001 From: Martin Ledvinka Date: Fri, 7 Jun 2024 10:46:02 +0200 Subject: [PATCH 2/2] [GH-1] Fix incorrect target release, unify Java distribution in all actions. --- .github/workflows/deploy-to-maven.yml | 4 ++-- .github/workflows/pull-request-to-main.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-to-maven.yml b/.github/workflows/deploy-to-maven.yml index 1717493..70d4d85 100644 --- a/.github/workflows/deploy-to-maven.yml +++ b/.github/workflows/deploy-to-maven.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '21' distribution: 'temurin' # Runs a set of commands using the runners shell @@ -32,7 +32,7 @@ jobs: uses: actions/setup-java@v4 with: # running setup-java again overwrites the settings.xml distribution: 'temurin' - java-version: '17' + java-version: '21' server-id: akaene # Value of the distributionManagement/repository/id field of the pom.xml server-username: MAVEN_USERNAME # env variable for username in deploy server-password: MAVEN_PASSWORD # env variable for password in deploy diff --git a/.github/workflows/pull-request-to-main.yml b/.github/workflows/pull-request-to-main.yml index a1d2fc7..fb54cf1 100644 --- a/.github/workflows/pull-request-to-main.yml +++ b/.github/workflows/pull-request-to-main.yml @@ -21,8 +21,8 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: - java-version: '17' - distribution: 'adopt' + java-version: '21' + distribution: 'temurin' # Runs a set of commands using the runners shell - name: Test