upload jar files to GitHub release

This commit is contained in:
John J. Aylward 2023-10-23 16:18:23 -04:00
parent 1ab11d0802
commit a2a8240d0d
2 changed files with 72 additions and 36 deletions

View File

@ -11,38 +11,72 @@ on:
types: [published] types: [published]
jobs: jobs:
publish: # old-school build and jar method. No tests run or compiled.
runs-on: ubuntu-latest publish-1_6:
permissions: name: Publish Java 1.6 to GitHub Release
contents: read runs-on: ubuntu-latest
packages: write permissions:
steps: contents: write
- uses: actions/checkout@v4 steps:
- name: Set up Java for publishing to Maven Central Repository - uses: actions/checkout@v4
uses: actions/setup-java@v3 - name: Setup java
with: uses: actions/setup-java@v1
# Use lowest supported LTS Java version with:
java-version: '8' java-version: 1.6
distribution: 'temurin' - name: Compile Java 1.6
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml run: |
server-username: MAVEN_USERNAME # env variable for username in deploy mkdir -p target/classes
server-password: MAVEN_PASSWORD # env variable for token in deploy javac -version
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import javac -d target/classes/ src/main/java/org/json/*.java
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase - name: Create JAR 1.6
run: |
- name: Publish to the Maven Central Repository jar cvf "target/org.json-1.6-${{ github.ref_name }}.jar" -C target/classes .
run: mvn --batch-mode deploy - name: Add 1.6 Jar To Release
env: uses: softprops/action-gh-release@v1
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} with:
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} append_body: true
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} files: |
# - name: Set up Java for publishing to GitHub Packages target/*.jar
# uses: actions/setup-java@v3 publish:
# with: name: Publish Java 8 to Maven Central and GitHub Release
# # Use lowest supported LTS Java version runs-on: ubuntu-latest
# java-version: '8' permissions:
# distribution: 'temurin' contents: write
# - name: Publish to GitHub Packages packages: write
# run: mvn --batch-mode deploy steps:
# env: - uses: actions/checkout@v4
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v3
with:
# Use lowest supported LTS Java version
java-version: '8'
distribution: 'temurin'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_PASSWORD # env variable for token in deploy
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Publish to the Maven Central Repository
run: mvn --batch-mode deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Add Jar To Release
uses: softprops/action-gh-release@v1
with:
append_body: true
files: |
target/*.jar
# - name: Set up Java for publishing to GitHub Packages
# uses: actions/setup-java@v3
# with:
# # Use lowest supported LTS Java version
# java-version: '8'
# distribution: 'temurin'
# - name: Publish to GitHub Packages
# run: mvn --batch-mode deploy
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -19,7 +19,7 @@ jobs:
java: [ 1.6 ] java: [ 1.6 ]
name: Java ${{ matrix.java }} name: Java ${{ matrix.java }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup java - name: Setup java
uses: actions/setup-java@v1 uses: actions/setup-java@v1
with: with:
@ -41,6 +41,8 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false
max-parallel: 2
matrix: matrix:
# build against supported Java LTS versions: # build against supported Java LTS versions:
java: [ 8, 11, 17, 21 ] java: [ 8, 11, 17, 21 ]