|
1 |
| -name: "CodeQL" |
| 1 | +name: CI |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - schedule: |
5 |
| - - cron: '0 15 * * 0' |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + - '[0-9]+.x' |
| 9 | + tags: |
| 10 | + - '*' |
| 11 | + paths-ignore: |
| 12 | + - 'docs/**' |
| 13 | + - '*.md' |
| 14 | + pull_request: |
| 15 | + paths-ignore: |
| 16 | + - 'docs/**' |
| 17 | + - '*.md' |
6 | 18 |
|
7 | 19 | jobs:
|
8 |
| - analyze: |
9 |
| - name: Analyze |
| 20 | + test: |
10 | 21 | runs-on: ubuntu-latest
|
11 |
| - permissions: |
12 |
| - actions: read |
13 |
| - contents: read |
14 |
| - security-events: write |
15 |
| - |
16 |
| - strategy: |
17 |
| - fail-fast: false |
18 |
| - matrix: |
19 |
| - language: [ 'java' ] |
20 |
| - |
21 | 22 | steps:
|
22 |
| - - name: Checkout repository |
| 23 | + - name: Checkout |
23 | 24 | uses: actions/checkout@v2
|
24 | 25 |
|
25 |
| - - name: Initialize CodeQL |
26 |
| - uses: github/codeql-action/init@v1 |
| 26 | + - name: Use JDK 11 |
| 27 | + uses: actions/setup-java@v2 |
| 28 | + with: |
| 29 | + java-version: '11' |
| 30 | + distribution: 'adopt' |
| 31 | + cache: gradle |
| 32 | + |
| 33 | + - name: Cache SonarCloud Packages |
| 34 | + uses: actions/cache@v2.1.7 |
27 | 35 | with:
|
28 |
| - languages: ${{ matrix.language }} |
| 36 | + path: ~/.sonar/cache |
| 37 | + key: ${{ runner.os }}-sonar |
| 38 | + restore-keys: ${{ runner.os }}-sonar |
| 39 | + |
| 40 | + - name: Cache Gradle Packages |
| 41 | + uses: actions/cache@v2.1.7 |
| 42 | + with: |
| 43 | + path: ~/.gradle/caches |
| 44 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} |
| 45 | + restore-keys: ${{ runner.os }}-gradle |
| 46 | + |
| 47 | + - name: Build |
| 48 | + run: | |
| 49 | + gradle build |
| 50 | + gradle jacocoRootTestReport |
| 51 | +
|
| 52 | + - name: Sonar |
| 53 | + if: github.ref == 'refs/heads/main' |
| 54 | + env: |
| 55 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 57 | + run: | |
| 58 | + gradle sonarqube --info |
| 59 | +
|
| 60 | + - name: Coverage |
| 61 | + if: github.ref == 'refs/heads/main' |
| 62 | + env: |
| 63 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 64 | + run: | |
| 65 | + bash <(curl -s https://codecov.io/bash) |
29 | 66 |
|
30 |
| - - name: JDK 11 |
| 67 | + automerge: |
| 68 | + needs: |
| 69 | + - test |
| 70 | + runs-on: ubuntu-latest |
| 71 | + permissions: |
| 72 | + pull-requests: write |
| 73 | + contents: write |
| 74 | + steps: |
| 75 | + - uses: fastify/github-action-merge-dependabot@v3.0.2 |
| 76 | + with: |
| 77 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 78 | + |
| 79 | + release: |
| 80 | + needs: |
| 81 | + - test |
| 82 | + runs-on: ubuntu-latest |
| 83 | + if: startsWith(github.ref, 'refs/tags/v') |
| 84 | + steps: |
| 85 | + - name: Checkout |
| 86 | + uses: actions/checkout@v2 |
| 87 | + |
| 88 | + - name: Use JDK 11 |
31 | 89 | uses: actions/setup-java@v2
|
32 | 90 | with:
|
33 | 91 | java-version: '11'
|
34 | 92 | distribution: 'adopt'
|
35 | 93 | cache: gradle
|
36 | 94 |
|
37 | 95 | - name: Build
|
| 96 | + run: gradle build |
| 97 | + |
| 98 | + - name: Decode |
38 | 99 | run: |
|
39 |
| - gradle build |
| 100 | + echo "${{secrets.SIGNING_SECRET_KEY_RING_FILE}}" > ~/.gradle/secring.gpg.b64 |
| 101 | + base64 -d ~/.gradle/secring.gpg.b64 > ~/.gradle/secring.gpg |
40 | 102 |
|
41 |
| - - name: Perform CodeQL Analysis |
42 |
| - uses: github/codeql-action/analyze@v1 |
| 103 | + - name: Publish Package |
| 104 | + env: |
| 105 | + ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USER }} |
| 106 | + ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} |
| 107 | + run: | |
| 108 | + gradle publishToSonatype -Psigning.keyId=${{secrets.SIGNING_KEY_ID}} -Psigning.password=${{secrets.SIGNING_KEY_PASSWORD}} -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg) |
| 109 | +
|
| 110 | + - name: Use Node |
| 111 | + id: setup-node |
| 112 | + uses: actions/setup-node@v2 |
| 113 | + with: |
| 114 | + node-version: 16.x |
| 115 | + |
| 116 | + - name: Latest Changelog |
| 117 | + run: | |
| 118 | + diff --changed-group-format='%>' --unchanged-group-format='' <( git show HEAD~1:CHANGELOG.md ) CHANGELOG.md > CHANGELOG_LATEST.md || true |
| 119 | +
|
| 120 | + - name: Create Release |
| 121 | + uses: actions/create-release@v1 |
| 122 | + env: |
| 123 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 124 | + with: |
| 125 | + tag_name: ${{ github.ref }} |
| 126 | + release_name: Release ${{ github.ref }} |
| 127 | + body_path: CHANGELOG_LATEST.md |
| 128 | + draft: false |
| 129 | + prerelease: contains(github.ref, '-') |
0 commit comments