|
3 | 3 | push: |
4 | 4 | pull_request_target: |
5 | 5 | types: [labeled] |
| 6 | + |
| 7 | +env: |
| 8 | + JAVA_VERSION: 25 |
| 9 | + |
6 | 10 | jobs: |
7 | 11 | build: |
8 | 12 | name: Build and Test |
9 | 13 | runs-on: ubuntu-latest |
10 | | - if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" |
| 14 | + permissions: |
| 15 | + id-token: write # Required for the attestations step |
| 16 | + attestations: write # Required for the attestations step |
11 | 17 | steps: |
12 | | - - uses: actions/checkout@v5 |
13 | | - - uses: actions/setup-java@v5 |
| 18 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 19 | + - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 |
14 | 20 | with: |
15 | 21 | distribution: 'temurin' |
16 | | - java-version: 21 |
| 22 | + java-version: ${{ env.JAVA_VERSION }} |
17 | 23 | cache: 'maven' |
18 | 24 | - name: Ensure to use tagged version |
19 | 25 | if: startsWith(github.ref, 'refs/tags/') |
20 | 26 | run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/} |
21 | 27 | - name: Build and Test |
22 | | - id: buildAndTest |
23 | | - run: mvn -B clean install |
24 | | - - uses: actions/upload-artifact@v4 |
| 28 | + run: mvn -B verify --no-transfer-progress |
| 29 | + - name: Attest |
| 30 | + if: startsWith(github.ref, 'refs/tags/') |
| 31 | + uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0 |
| 32 | + with: |
| 33 | + subject-path: | |
| 34 | + target/*.jar |
| 35 | + target/*.pom |
| 36 | + - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 |
25 | 37 | with: |
26 | 38 | name: artifacts |
27 | 39 | path: target/*.jar |
28 | | - - name: Create Release |
29 | | - uses: softprops/action-gh-release@v2 |
| 40 | + |
| 41 | + deploy-central: |
| 42 | + name: Deploy to Maven Central |
| 43 | + runs-on: ubuntu-latest |
| 44 | + permissions: {} |
| 45 | + needs: [build] |
| 46 | + if: github.repository_owner == 'cryptomator' && (startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[deploy]')) |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 49 | + - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 |
| 50 | + with: |
| 51 | + distribution: 'temurin' |
| 52 | + java-version: ${{ env.JAVA_VERSION }} |
| 53 | + cache: 'maven' |
| 54 | + server-id: central |
| 55 | + server-username: MAVEN_CENTRAL_USERNAME |
| 56 | + server-password: MAVEN_CENTRAL_PASSWORD |
| 57 | + - name: Ensure to use tagged version |
30 | 58 | if: startsWith(github.ref, 'refs/tags/') |
| 59 | + run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/} |
| 60 | + - name: Verify project version is -SNAPSHOT |
| 61 | + if: startsWith(github.ref, 'refs/tags/') == false |
| 62 | + run: | |
| 63 | + PROJECT_VERSION=$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout) |
| 64 | + test "${PROJECT_VERSION: -9}" = "-SNAPSHOT" |
| 65 | + - name: Deploy to Maven Central |
| 66 | + run: mvn deploy -B -DskipTests -Psign,deploy-central --no-transfer-progress |
| 67 | + env: |
| 68 | + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} |
| 69 | + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} |
| 70 | + MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }} |
| 71 | + MAVEN_GPG_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import |
| 72 | + MAVEN_GPG_KEY_FINGERPRINT: ${{ vars.RELEASES_GPG_KEY_FINGERPRINT }} |
| 73 | + |
| 74 | + deploy-github: |
| 75 | + name: Deploy to GitHub Packages |
| 76 | + runs-on: ubuntu-latest |
| 77 | + permissions: |
| 78 | + packages: write # Required for the deploy to GitHub Packages step |
| 79 | + needs: [build] |
| 80 | + if: github.repository_owner == 'cryptomator' && (startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[deploy]')) |
| 81 | + steps: |
| 82 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 83 | + - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 |
| 84 | + with: |
| 85 | + java-version: ${{ env.JAVA_VERSION }} |
| 86 | + distribution: 'temurin' |
| 87 | + cache: 'maven' |
| 88 | + - name: Ensure to use tagged version |
| 89 | + if: startsWith(github.ref, 'refs/tags/') |
| 90 | + run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/} |
| 91 | + - name: Verify project version is -SNAPSHOT |
| 92 | + if: startsWith(github.ref, 'refs/tags/') == false |
| 93 | + run: | |
| 94 | + PROJECT_VERSION=$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout) |
| 95 | + test "${PROJECT_VERSION: -9}" = "-SNAPSHOT" |
| 96 | + - name: Deploy to GitHub Packages |
| 97 | + run: mvn deploy -B -DskipTests -Psign,deploy-github --no-transfer-progress |
| 98 | + env: |
| 99 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 100 | + MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }} |
| 101 | + MAVEN_GPG_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import |
| 102 | + MAVEN_GPG_KEY_FINGERPRINT: ${{ vars.RELEASES_GPG_KEY_FINGERPRINT }} |
| 103 | + |
| 104 | + release: |
| 105 | + name: Release |
| 106 | + runs-on: ubuntu-latest |
| 107 | + permissions: |
| 108 | + contents: write # Required for the release step |
| 109 | + needs: [deploy-central, deploy-github] |
| 110 | + if: startsWith(github.ref, 'refs/tags/') |
| 111 | + steps: |
| 112 | + - name: Create Release |
| 113 | + uses: softprops/action-gh-release@6da8fa9354ddfdc4aeace5fc48d7f679b5214090 # v2.4.1 |
31 | 114 | with: |
32 | 115 | prerelease: true |
33 | 116 | token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }} |
34 | 117 | generate_release_notes: true |
| 118 | + body: | |
| 119 | + For a list of all notable changes, read the [changelog](/CHANGELOG.md). |
0 commit comments