Skip to content

Commit

Permalink
Update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
YaSuenag committed Mar 22, 2024
1 parent 18019c8 commit f4dee40
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 67 deletions.
78 changes: 16 additions & 62 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,76 +1,30 @@
name: CI

on:
push:
pull_request:
branches: [master]

jobs:
compile:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
cache: maven
- name: Run Maven
run: mvn -B -P dev compile
- name: Upload Maven repo
uses: actions/upload-artifact@v3
with:
name: compiled-repo
path: ${{ github.workspace }}

test:
needs: compile
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
runs-on: ${{ matrix.os }}
name: Run tests on ${{ matrix.os }}
steps:
- name: Download Maven repo
uses: actions/download-artifact@v3
with:
name: compiled-repo
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
cache: maven
- if: runner.os == 'Linux'
run: mvn -B -P dev test
- if: runner.os != 'Linux'
run: mvn -B -P unsupported-platform-test test

publish:
needs: test
snapshot-deploy:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Download Maven repo
uses: actions/download-artifact@v3
with:
name: compiled-repo
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
distribution: oracle
java-version: |
8
22
cache: maven
- name: Deploy to GitHub Packages
run: mvn -B -P dev deploy
- name: Run Maven with Java 8
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Remove stale packages
uses: actions/delete-package-versions@v4
with:
package-name: com.yasuenag.hwrand
package-type: maven
min-versions-to-keep: 1
delete-only-pre-release-versions: "true"
JAVA_HOME: ${{ env.JAVA_HOME_8_x64 }}
run: mvn -B compile test
- name: Run Maven with Java 22
env:
JAVA_HOME: ${{ env.JAVA_HOME_22_x64 }}
run: mvn -B package
31 changes: 31 additions & 0 deletions .github/workflows/push-master.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Deploy snapshot library

on:
push:
branches: [master]

jobs:
snapshot-deploy:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: oracle
java-version: |
8
22
cache: maven
- name: Run Maven with Java 8
env:
JAVA_HOME: ${{ env.JAVA_HOME_8_x64 }}
run: mvn -B -DskipTests compile
- name: Run Maven with Java 22
env:
JAVA_HOME: ${{ env.JAVA_HOME_22_x64 }}
GITHUB_TOKEN: ${{ github.token }}
run: mvn -B -DskipTests deploy
17 changes: 12 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
distribution: oracle
java-version: |
8
22
cache: maven
- name: Run Maven
run: mvn -B -P release -DskipTests deploy
- name: Run Maven with Java 8
env:
JAVA_HOME: ${{ env.JAVA_HOME_8_x64 }}
run: mvn -B compile test
- name: Run Maven with Java 22
env:
JAVA_HOME: ${{ env.JAVA_HOME_22_x64 }}
GITHUB_TOKEN: ${{ github.token }}
run: mvn -B deploy

0 comments on commit f4dee40

Please sign in to comment.