Skip to content

Commit

Permalink
Update for Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mercyblitz committed Aug 8, 2024
1 parent 5316a46 commit 2ea2d2f
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 13 deletions.
26 changes: 14 additions & 12 deletions .github/workflows/maven.yml → .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# separate terms of service, privacy policy, and support
# documentation.

name: Java CI with Maven
name: Maven Build

on:
push:
Expand All @@ -16,16 +16,18 @@ on:

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
java: [ '8', '11' , '17' , '21' ]
steps:
- uses: actions/checkout@v4
- name: Java 8
uses: actions/setup-java@v4
with:
java-version: '8.0.392+8'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn --batch-mode --update-snapshots --file pom.xml -Drevision=0.0.1-SNAPSHOT clean install
- name: Checkout Source
uses: actions/checkout@v4
- name: Setup JDK ${{ matrix.Java }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: maven
- name: Build with Maven
run: mvn --batch-mode --update-snapshots --file pom.xml -Drevision=0.0.1-SNAPSHOT clean install
46 changes: 46 additions & 0 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Maven Publish

on:
push:
branches: [ 'release' ]
workflow_dispatch:
inputs:
revision:
description: 'The version to release'
required: true
default: '0.0.1-SNAPSHOT'

jobs:
build:
runs-on: ubuntu-latest
if: ${{ inputs.revision }}
steps:
- name: Checkout Source
uses: actions/checkout@v4

- name: Setup Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
cache: maven

- name: Publish package
run: mvn --batch-mode --update-snapshots -Drevision=${{ inputs.revision }} -Dgpg.skip=true -Prelease,ci clean deploy
env:
MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSS_SONATYPE_PASSWORD }}
SIGN_KEY_ID: ${{ secrets.OSS_SIGNING_KEY_ID_LONG }}
SIGN_KEY: ${{ secrets.OSS_SIGNING_KEY }}
SIGN_KEY_PASS: ${{ secrets.OSS_SIGNING_PASSWORD }}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-build</artifactId>
<version>0.0.15</version>
<version>0.0.21</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down

0 comments on commit 2ea2d2f

Please sign in to comment.