|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '**' |
| 7 | + paths-ignore: |
| 8 | + - 'LICENSE' |
| 9 | + - 'README.adoc' |
| 10 | + - 'docs/**' |
| 11 | + tags-ignore: |
| 12 | + - 'v*' |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +jobs: |
| 16 | + |
| 17 | + version: |
| 18 | + name: check version |
| 19 | + runs-on: ubuntu-latest |
| 20 | + outputs: |
| 21 | + BUILD_VERSION: ${{ env.BUILD_VERSION }} |
| 22 | + |
| 23 | + steps: |
| 24 | + - name: Set up Homebrew |
| 25 | + id: set-up-homebrew |
| 26 | + uses: Homebrew/actions/setup-homebrew@master |
| 27 | + |
| 28 | + - name: checkout |
| 29 | + uses: actions/checkout@v4 |
| 30 | + |
| 31 | + - name: install dasel |
| 32 | + run: | |
| 33 | + brew install dasel |
| 34 | + cat $GITHUB_ENV |
| 35 | +
|
| 36 | + - name: extract version |
| 37 | + run: | |
| 38 | + version=`dasel -r xml -f pom.xml project.version` |
| 39 | + echo "BUILD_VERSION=${version#projectVersion=}" >> $GITHUB_ENV |
| 40 | + cat $GITHUB_ENV |
| 41 | +
|
| 42 | + - name: actor |
| 43 | + run: echo ${{ github.actor }} ${{ github.actor == 'hauner' }} |
| 44 | + |
| 45 | + test: |
| 46 | + name: test |
| 47 | + |
| 48 | + runs-on: ${{ matrix.os }} |
| 49 | + strategy: |
| 50 | + matrix: |
| 51 | + os: [ubuntu-latest, windows-latest] |
| 52 | + |
| 53 | + steps: |
| 54 | + - name: checkout |
| 55 | + uses: actions/checkout@v4 |
| 56 | + with: |
| 57 | + submodules: true |
| 58 | + |
| 59 | + - name: set up jdk |
| 60 | + uses: actions/setup-java@v4 |
| 61 | + with: |
| 62 | + distribution: 'temurin' |
| 63 | + java-version: 11 |
| 64 | + cache: maven |
| 65 | + |
| 66 | + - name: set up gradle |
| 67 | + uses: gradle/gradle-build-action@v3.0.0 |
| 68 | + |
| 69 | + - name: run tests |
| 70 | + run: | |
| 71 | + ./mvnw verify |
| 72 | +
|
| 73 | + - name: archive test results |
| 74 | + uses: actions/upload-artifact@v4 |
| 75 | + if: always() |
| 76 | + with: |
| 77 | + name: test-results-${{ matrix.os }} |
| 78 | + path: '*/target' |
| 79 | + |
| 80 | + publish: |
| 81 | + if: contains(needs.version.outputs.BUILD_VERSION, 'SNAPSHOT') && github.actor == 'hauner' |
| 82 | + needs: [version, test] |
| 83 | + name: publish snapshot |
| 84 | + |
| 85 | + runs-on: ubuntu-latest |
| 86 | + |
| 87 | + steps: |
| 88 | + - name: checkout |
| 89 | + uses: actions/checkout@v4 |
| 90 | + |
| 91 | + - name: set up jdk |
| 92 | + uses: actions/setup-java@v4 |
| 93 | + with: |
| 94 | + distribution: 'temurin' |
| 95 | + java-version: 11 |
| 96 | + |
| 97 | + - name: publish snapshot |
| 98 | + env: |
| 99 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 100 | + SIGN_KEY: ${{ secrets.SIGN_KEY }} |
| 101 | + SIGN_PWD: ${{ secrets.SIGN_PWD }} |
| 102 | + PUBLISH_USER: ${{ secrets.PUBLISH_USER }} |
| 103 | + PUBLISH_KEY: ${{ secrets.PUBLISH_KEY }} |
| 104 | + run: | |
| 105 | + ./mvnw deploy -P snapshot |
0 commit comments