|
| 1 | +name: Make release |
| 2 | + |
| 3 | +on: |
| 4 | + pull: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Build |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v3 |
| 14 | + with: |
| 15 | + fetch-depth: 0 |
| 16 | + - name: Set up JDK 8 |
| 17 | + uses: actions/setup-java@v3 |
| 18 | + with: |
| 19 | + java-version: 8 |
| 20 | + distribution: 'temurin' |
| 21 | + - name: Cache Maven packages |
| 22 | + uses: actions/cache@v3 |
| 23 | + with: |
| 24 | + path: ~/.m2 |
| 25 | + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} |
| 26 | + restore-keys: ${{ runner.os }}-m2 |
| 27 | + - name: Build |
| 28 | + run: mvn clean verify |
| 29 | + |
| 30 | + test: |
| 31 | + name: Test |
| 32 | + needs: build |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v3 |
| 36 | + with: |
| 37 | + fetch-depth: 0 |
| 38 | + - name: Set up JDK 8 |
| 39 | + uses: actions/setup-java@v3 |
| 40 | + with: |
| 41 | + java-version: 8 |
| 42 | + distribution: 'temurin' |
| 43 | + - name: Cache Maven packages |
| 44 | + uses: actions/cache@v3 |
| 45 | + with: |
| 46 | + path: ~/.m2 |
| 47 | + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} |
| 48 | + restore-keys: ${{ runner.os }}-m2 |
| 49 | + - name: Build |
| 50 | + run: mvn clean package install -DskipTests=true |
| 51 | + - name: Build, test |
| 52 | + run: mvn -B test |
| 53 | + |
| 54 | + publish-OSSRH: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + name: Publish to Maven Central |
| 57 | + needs: test |
| 58 | + permissions: |
| 59 | + contents: read |
| 60 | + packages: write |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@v3 |
| 63 | + with: |
| 64 | + fetch-depth: 0 |
| 65 | + |
| 66 | + - id: install-secret-key |
| 67 | + name: Install gpg secret key |
| 68 | + run: | |
| 69 | + cat <(echo -e "${{ secrets.GPG_PRIVATE_KEY }}") | gpg --batch --import |
| 70 | + gpg --list-secret-keys --keyid-format LONG |
| 71 | +
|
| 72 | + - name: Set up Maven Central Repository |
| 73 | + uses: actions/setup-java@v3 |
| 74 | + with: |
| 75 | + java-version: 8 |
| 76 | + distribution: 'temurin' |
| 77 | + server-id: central |
| 78 | + server-username: MAVEN_USERNAME |
| 79 | + server-password: MAVEN_PASSWORD |
| 80 | + |
| 81 | + - name: Publish package |
| 82 | + run: mvn -DskipTests=true --batch-mode -P release -Dgpg.passphrase=${{ secrets.OSS_PASSWORD }} deploy |
| 83 | + env: |
| 84 | + MAVEN_USERNAME: ${{ secrets.OSS_USERNAME }} |
| 85 | + MAVEN_PASSWORD: ${{ secrets.OSS_PASSWORD }} |
0 commit comments