|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + [push] |
| 5 | + |
| 6 | +jobs: |
| 7 | + build: |
| 8 | + name: Build and Test |
| 9 | + runs-on: ubuntu-latest |
| 10 | + if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" |
| 11 | + env: |
| 12 | + BUILD_VERSION: SNAPSHOT |
| 13 | + outputs: |
| 14 | + artifact-version: ${{ steps.setversion.outputs.version }} |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v2 |
| 17 | + - uses: actions/setup-java@v1 |
| 18 | + with: |
| 19 | + java-version: 11 |
| 20 | + server-id: bintray-jcenter |
| 21 | + server-username: BINTRAY_USERNAME |
| 22 | + server-password: BINTRAY_API_KEY |
| 23 | + - uses: actions/cache@v1 |
| 24 | + with: |
| 25 | + path: ~/.m2/repository |
| 26 | + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 27 | + restore-keys: | |
| 28 | + ${{ runner.os }}-maven- |
| 29 | + - name: Ensure to use tagged version |
| 30 | + run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/} |
| 31 | + if: startsWith(github.ref, 'refs/tags/') |
| 32 | + - name: Export the project version to the job environment and fix it as an ouput of this job |
| 33 | + id: setversion |
| 34 | + run: | |
| 35 | + v=$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout) |
| 36 | + echo "BUILD_VERSION=${v}" >> $GITHUB_ENV |
| 37 | + echo "::set-output name=version::${v}" |
| 38 | + shell: bash |
| 39 | + - name: Build and Test |
| 40 | + run: mvn -B install |
| 41 | + - name: Upload .jars |
| 42 | + uses: actions/upload-artifact@v2 |
| 43 | + with: |
| 44 | + name: integrations-linux-${{ env.BUILD_VERSION }} |
| 45 | + path: target/integrations-linux-*.jar |
| 46 | + - name: Build and deploy to jcenter |
| 47 | + if: startsWith(github.ref, 'refs/tags/') |
| 48 | + run: mvn -B deploy -DskipTests |
| 49 | + env: |
| 50 | + BINTRAY_USERNAME: cryptobot |
| 51 | + BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }} |
0 commit comments