Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
Update github actions
Browse files Browse the repository at this point in the history
Signed-off-by: zhaoxinn <[email protected]>
  • Loading branch information
zxzinn committed Aug 1, 2024
1 parent 1465e3a commit c9ccbb9
Showing 1 changed file with 56 additions and 6 deletions.
62 changes: 56 additions & 6 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,77 @@ permissions:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

strategy:
matrix:
java: [21]
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.java }}
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
java-version: '21'
distribution: 'temurin'
cache: maven

- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Run tests
run: mvn test

- name: Upload test coverage
uses: actions/upload-artifact@v4
with:
name: jacoco-report
path: target/site/jacoco/

- name: Upload JAR
uses: actions/upload-artifact@v4
with:
name: Package-JDK${{ matrix.java }}
path: target/*.jar
name: Package-JDK21-${{ matrix.os }}
path: target/*.jar

- name: Publish to GitHub Packages
env:
GITHUB_TOKEN: ${{ github.token }}
run: mvn deploy

release:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master'

steps:
- name: Download JAR from build job
uses: actions/download-artifact@v4
with:
name: Package-JDK21-ubuntu-latest

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes in this Release
- First Change
- Second Change
draft: false
prerelease: false

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./novelai-desktop.jar
asset_name: novelai-desktop.jar
asset_content_type: application/java-archive

0 comments on commit c9ccbb9

Please sign in to comment.