|
11 | 11 | types: [published]
|
12 | 12 |
|
13 | 13 | jobs:
|
14 |
| - publish: |
15 |
| - runs-on: ubuntu-latest |
16 |
| - permissions: |
17 |
| - contents: read |
18 |
| - packages: write |
19 |
| - steps: |
20 |
| - - uses: actions/checkout@v4 |
21 |
| - - name: Set up Java for publishing to Maven Central Repository |
22 |
| - uses: actions/setup-java@v3 |
23 |
| - with: |
24 |
| - # Use lowest supported LTS Java version |
25 |
| - java-version: '8' |
26 |
| - distribution: 'temurin' |
27 |
| - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml |
28 |
| - server-username: MAVEN_USERNAME # env variable for username in deploy |
29 |
| - server-password: MAVEN_PASSWORD # env variable for token in deploy |
30 |
| - gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import |
31 |
| - gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase |
32 |
| - |
33 |
| - - name: Publish to the Maven Central Repository |
34 |
| - run: mvn --batch-mode deploy |
35 |
| - env: |
36 |
| - MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} |
37 |
| - MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} |
38 |
| - MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} |
39 |
| - # - name: Set up Java for publishing to GitHub Packages |
40 |
| - # uses: actions/setup-java@v3 |
41 |
| - # with: |
42 |
| - # # Use lowest supported LTS Java version |
43 |
| - # java-version: '8' |
44 |
| - # distribution: 'temurin' |
45 |
| - # - name: Publish to GitHub Packages |
46 |
| - # run: mvn --batch-mode deploy |
47 |
| - # env: |
48 |
| - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 14 | + # old-school build and jar method. No tests run or compiled. |
| 15 | + publish-1_6: |
| 16 | + name: Publish Java 1.6 to GitHub Release |
| 17 | + runs-on: ubuntu-latest |
| 18 | + permissions: |
| 19 | + contents: write |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + - name: Setup java |
| 23 | + uses: actions/setup-java@v1 |
| 24 | + with: |
| 25 | + java-version: 1.6 |
| 26 | + - name: Compile Java 1.6 |
| 27 | + run: | |
| 28 | + mkdir -p target/classes |
| 29 | + javac -version |
| 30 | + javac -d target/classes/ src/main/java/org/json/*.java |
| 31 | + - name: Create JAR 1.6 |
| 32 | + run: | |
| 33 | + jar cvf "target/org.json-1.6-${{ github.ref_name }}.jar" -C target/classes . |
| 34 | + - name: Add 1.6 Jar To Release |
| 35 | + uses: softprops/action-gh-release@v1 |
| 36 | + with: |
| 37 | + append_body: true |
| 38 | + files: | |
| 39 | + target/*.jar |
| 40 | + publish: |
| 41 | + name: Publish Java 8 to Maven Central and GitHub Release |
| 42 | + runs-on: ubuntu-latest |
| 43 | + permissions: |
| 44 | + contents: write |
| 45 | + packages: write |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + - name: Set up Java for publishing to Maven Central Repository |
| 49 | + uses: actions/setup-java@v3 |
| 50 | + with: |
| 51 | + # Use lowest supported LTS Java version |
| 52 | + java-version: '8' |
| 53 | + distribution: 'temurin' |
| 54 | + server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml |
| 55 | + server-username: MAVEN_USERNAME # env variable for username in deploy |
| 56 | + server-password: MAVEN_PASSWORD # env variable for token in deploy |
| 57 | + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import |
| 58 | + gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase |
| 59 | + |
| 60 | + - name: Publish to the Maven Central Repository |
| 61 | + run: mvn --batch-mode deploy |
| 62 | + env: |
| 63 | + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} |
| 64 | + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} |
| 65 | + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} |
| 66 | + |
| 67 | + - name: Add Jar To Release |
| 68 | + uses: softprops/action-gh-release@v1 |
| 69 | + with: |
| 70 | + append_body: true |
| 71 | + files: | |
| 72 | + target/*.jar |
| 73 | + # - name: Set up Java for publishing to GitHub Packages |
| 74 | + # uses: actions/setup-java@v3 |
| 75 | + # with: |
| 76 | + # # Use lowest supported LTS Java version |
| 77 | + # java-version: '8' |
| 78 | + # distribution: 'temurin' |
| 79 | + # - name: Publish to GitHub Packages |
| 80 | + # run: mvn --batch-mode deploy |
| 81 | + # env: |
| 82 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments