Skip to content

fixup urls in pom.xml & use checkout@v4 in ci #26

fixup urls in pom.xml & use checkout@v4 in ci

fixup urls in pom.xml & use checkout@v4 in ci #26

Workflow file for this run

name: Java
on:
push:
branches: [ "main" ]
tags: [ 'pre-*' ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: macos-latest
name: Java ${{ matrix.java }}
strategy:
matrix:
java:
- '17' # EOL: 2026-09
- '21' # EOL: 2028-09
#- '22' # REL: 2024-03
#- '23' # REL: 2024-09
#- '24' # REL: 2025-03
#- '25' # REL: 2025-09
# see supported java release schedule at https://www.oracle.com/java/technologies/java-se-support-roadmap.html
steps:
- uses: actions/checkout@v4
with:
repository: getargv/getargv
path: getargv
token: ${{ secrets.GH_PAT }}
- name: Build libgetargv
run: make install_dylib
working-directory: getargv
- uses: actions/checkout@v4
with:
path: getargv.java
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: maven
check-latest: true
- name: Build with Maven
run: mvn -B package --file pom.xml
working-directory: getargv.java
- name: Test with Maven
run: mvn -B test --file pom.xml
working-directory: getargv.java
release:
permissions:
contents: write
packages: write
needs: [ build ]
runs-on: macos-latest
# maven created a new tag but we only trigger on 'pre-' prefixed tags in 'on:' clause above
if: ${{ github.ref_type == 'tag' }}
steps:
- uses: actions/checkout@v4
with:
repository: getargv/getargv
path: getargv
token: ${{ secrets.GH_PAT }}
- name: Build libgetargv
run: make install_dylib
working-directory: getargv
- uses: actions/checkout@v4
with:
# maven needs to be on a branch, not a tag, but we trigger on a tag...
ref: main
path: getargv.java
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
check-latest: true
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-passphrase: MAVEN_GPG_PASSPHRASE
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
- name: Publish package to Maven Central
run: make release
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
working-directory: getargv.java
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
check-latest: true
server-id: github
- name: Publish package to GitHub Packages
run: make release_github
env:
GITHUB_TOKEN: ${{ github.token }}
working-directory: getargv.java