|
| 1 | +# This workflow will build a Java project with Maven |
| 2 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven |
| 3 | + |
| 4 | +name: Continuous Delivery Java 11 |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [ java11 ] |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + timeout-minutes: 10 |
| 14 | + |
| 15 | + env: |
| 16 | + JSCC_VERSION_PREFIX: 'java11-1.' |
| 17 | + JSCC_TAG_PREFIX: 'java11-1.' |
| 18 | + |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v2 |
| 22 | + - name: Set up JDK 11 |
| 23 | + uses: actions/setup-java@v2 |
| 24 | + with: |
| 25 | + distribution: 'zulu' |
| 26 | + java-version: '11' |
| 27 | + java-package: jdk+fx |
| 28 | + |
| 29 | + ## Enable Caching |
| 30 | + - uses: actions/cache@v2 |
| 31 | + id: cache |
| 32 | + with: |
| 33 | + path: ~/.m2/repository |
| 34 | + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 35 | + restore-keys: | |
| 36 | + ${{ runner.os }}-maven- |
| 37 | +
|
| 38 | + - name: Bump version and create tag |
| 39 | + id: semanticversion |
| 40 | + uses: hennejg/github-tag-action@v4.3.1 |
| 41 | + with: |
| 42 | + release_branches: java11 |
| 43 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 44 | + tag_prefix: ${{ env.JSCC_TAG_PREFIX }} |
| 45 | + |
| 46 | + - name: Verify and print new build number |
| 47 | + run: | |
| 48 | + if echo '${{ steps.semanticversion.outputs.new_tag }}' |grep -Eq '^${{ env.JSCC_TAG_PREFIX }}[0-9]+[.][0-9]+[.][0-9]+$'; then |
| 49 | + echo New version '${{ steps.semanticversion.outputs.new_version }}', Changelog '${{ steps.semanticversion.outputs.changelog }}' |
| 50 | + else |
| 51 | + echo 'unexpected tag format - aborting' |
| 52 | + exit -1 |
| 53 | + fi |
| 54 | +
|
| 55 | + - name: Set version to environment variable |
| 56 | + run: echo "NEW_VERSION=${{ env.JSCC_VERSION_PREFIX }}${{ steps.semanticversion.outputs.new_version }}" >> $GITHUB_ENV |
| 57 | + |
| 58 | + - name: run mvn set version |
| 59 | + run: | |
| 60 | + mvn -s .m2/settings.xml versions:set -DnewVersion=${{ env.NEW_VERSION }} |
| 61 | + env: |
| 62 | + NEXUS_USERID: ${{secrets.NEXUS_USERID}} |
| 63 | + NEXUS_PASSWORD: ${{secrets.NEXUS_PASSWORD}} |
| 64 | + |
| 65 | + ## Initializes the CodeQL tools for scanning. |
| 66 | + - name: Initialize CodeQL |
| 67 | + uses: github/codeql-action/init@v1 |
| 68 | + with: |
| 69 | + languages: ${{ matrix.language }} |
| 70 | + |
| 71 | + - name: Build with Maven |
| 72 | + run: mvn -s .m2/settings.xml -gs .m2/settings.xml -B package --file pom.xml |
| 73 | + env: |
| 74 | + NEXUS_USERID: ${{secrets.NEXUS_USERID}} |
| 75 | + NEXUS_PASSWORD: ${{secrets.NEXUS_PASSWORD}} |
| 76 | + |
| 77 | + - name: Perform CodeQL Analysis |
| 78 | + uses: github/codeql-action/analyze@v1 |
| 79 | + |
| 80 | + - name: Create Release |
| 81 | + id: create_release |
| 82 | + uses: actions/create-release@v1 |
| 83 | + env: |
| 84 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 85 | + with: |
| 86 | + tag_name: ${{ env.NEW_VERSION }} |
| 87 | + release_name: ${{ env.NEW_VERSION }} |
| 88 | + draft: false |
| 89 | + prerelease: false |
| 90 | + |
| 91 | + - name: Upload Release Asset |
| 92 | + id: upload-release-asset |
| 93 | + uses: actions/upload-release-asset@v1 |
| 94 | + env: |
| 95 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 96 | + with: |
| 97 | + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps |
| 98 | + asset_path: ./target/jadice-server-converter-client-${{ env.NEW_VERSION }}.exe |
| 99 | + asset_name: jadice-server-converter-client-${{ env.NEW_VERSION }}.exe |
| 100 | + asset_content_type: application/octet-stream |
0 commit comments