Skip to content

Commit

Permalink
[GH-1] Add GH workflows for PR testing and Maven deploy on push to main.
Browse files Browse the repository at this point in the history
  • Loading branch information
ledsoft committed Jun 7, 2024
1 parent dff572a commit 9589f6a
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/deploy-to-maven.yml
Original file line number Diff line number Diff line change
@@ -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 }}
29 changes: 29 additions & 0 deletions .github/workflows/pull-request-to-main.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9589f6a

Please sign in to comment.