publish without an initiating tag, and print settings.xml on failure #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Java | |
on: | |
push: | |
branches: [ "main" ] | |
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@v4 | |
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 | |
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 | |
uses: actions/setup-java@v4 | |
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@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
check-latest: true | |
server-id: github | |
- name: Publish package to GitHub Packages | |
run: mvn -DuseGithub=true --batch-mode deploy | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
working-directory: getargv.java | |
- run: cat ~/.m2/settings.xml && false | |
if: ${{ failure() }} |