|
| 1 | +# Release build pipeline, operates on `release_*` branches and creates releases |
| 2 | + |
| 3 | +name: CI Release branch |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: [ "dev" ] # trap each push to dev branch TODO SKA change back to dev |
| 8 | + paths: # but react only to changes in code or pipeline definition |
| 9 | + - src/**.* |
| 10 | + - .github/**.* |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + permissions: |
| 15 | + # write permission is required to create a github release |
| 16 | + contents: write |
| 17 | + # write permission is required for autolabeler |
| 18 | + # otherwise, read permission is required at least |
| 19 | + pull-requests: write |
| 20 | + |
| 21 | + outputs: |
| 22 | + release_id: ${{ steps.create_release.outputs.id }} |
| 23 | + released_version: ${{ steps.release_version.outputs.version }} |
| 24 | + |
| 25 | + env: |
| 26 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + |
| 28 | + runs-on: ubuntu-latest |
| 29 | + |
| 30 | + steps: |
| 31 | + |
| 32 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 # checkout sources |
| 33 | + with: |
| 34 | + ref: ${{ github.ref }} |
| 35 | + fetch-depth: 0 |
| 36 | + |
| 37 | + - name: Resolve new release version |
| 38 | + id: release_version |
| 39 | + uses: lukashornych/semantic-calendar-version@bb0a07cf0ca71a0b2b4fed52114e28092e5cac81 #v1.2.0 |
| 40 | + with: |
| 41 | + prefix: 'v' |
| 42 | + year_switch_mode: 'OnMinor' |
| 43 | + minor-identifier: '/feat(?:\\([^)]+\\))?:/' |
| 44 | + |
| 45 | + - name: Setup Java JDK |
| 46 | + uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0 setup JDK 17 for building |
| 47 | + with: |
| 48 | + java-version: 8 |
| 49 | + distribution: 'temurin' |
| 50 | + cache: 'maven' |
| 51 | + server-id: ossrh |
| 52 | + server-username: MAVEN_USERNAME |
| 53 | + server-password: MAVEN_CENTRAL_TOKEN |
| 54 | + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} |
| 55 | + gpg-passphrase: MAVEN_GPG_PASSPHRASE |
| 56 | + |
| 57 | + - name: Build with Maven |
| 58 | + run: | |
| 59 | + export CURRENT_VERSION="${{ steps.release_version.outputs.version }}" |
| 60 | + export NEW_VERSION="$( echo ${CURRENT_VERSION} | sed 's/^v//')" |
| 61 | + mvn versions:set -DnewVersion=$NEW_VERSION |
| 62 | + mvn -T 1C -B -P release-sign-artifacts -Dmaven.test.skip=true deploy --file pom.xml |
| 63 | + env: |
| 64 | + EVITA_BUILD_VERSION: ${{ steps.release_version.outputs.version }} |
| 65 | + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} |
| 66 | + MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} |
| 67 | + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} |
| 68 | + |
| 69 | + - name: Create distribution directory |
| 70 | + run: | |
| 71 | + mkdir -p ./dist |
| 72 | + cp LICENSE ./dist |
| 73 | + cp 'target/babylon-boot.jar' ./dist |
| 74 | +
|
| 75 | + - name: Create .zip of dist |
| 76 | + uses: thedoctor0/zip-release@b57d897cb5d60cb78b51a507f63fa184cfe35554 # v0.7.6 |
| 77 | + with: |
| 78 | + type: 'zip' |
| 79 | + filename: 'dist.zip' |
| 80 | + path: './dist' |
| 81 | + |
| 82 | + - name: Create .tar.gz of dist |
| 83 | + uses: thedoctor0/zip-release@b57d897cb5d60cb78b51a507f63fa184cfe35554 # v0.7.6 |
| 84 | + with: |
| 85 | + type: 'tar' |
| 86 | + filename: 'dist.tar.gz' |
| 87 | + path: './dist' |
| 88 | + |
| 89 | + - name: Create release |
| 90 | + id: create_release |
| 91 | + uses: release-drafter/release-drafter@b1476f6e6eb133afa41ed8589daba6dc69b4d3f5 # v6.1.0 |
| 92 | + with: |
| 93 | + version: ${{ steps.release_version.outputs.version }} |
| 94 | + publish: true |
| 95 | + |
| 96 | + - name: Upload dist.zip to release |
| 97 | + uses: actions/upload-release-asset@64e5e85fc528f162d7ba7ce2d15a3bb67efb3d80 # v1.0.1 |
| 98 | + if: success() |
| 99 | + with: |
| 100 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 101 | + asset_path: ./dist.zip |
| 102 | + asset_name: Dist (zip) |
| 103 | + asset_content_type: application/zip |
| 104 | + |
| 105 | + - name: Upload dist.tar.gz to release |
| 106 | + uses: actions/upload-release-asset@64e5e85fc528f162d7ba7ce2d15a3bb67efb3d80 # v1.0.1 |
| 107 | + if: success() |
| 108 | + with: |
| 109 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 110 | + asset_path: ./dist.tar.gz |
| 111 | + asset_name: Dist (tar.gz) |
| 112 | + asset_content_type: application/gzip |
| 113 | + |
| 114 | + - name: Upload babylon server artifact # upload `babylon-boot.jar` for `docker-latest.yml` to deploy to DockerHub |
| 115 | + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 |
| 116 | + if: success() |
| 117 | + with: |
| 118 | + name: babylon-boot.jar |
| 119 | + path: 'target/babylon-boot.jar' |
0 commit comments