|
| 1 | +name: devnet-bundle-release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + releaseVersion: |
| 7 | + description: "Release version" |
| 8 | + required: true |
| 9 | + nextDevVersion: |
| 10 | + description: "Next SNAPSHOT version" |
| 11 | + required: true |
| 12 | + |
| 13 | +env: |
| 14 | + RELEASE_VERSION: ${{ github.event.inputs.releaseVersion }} |
| 15 | + NEXT_DEV_VERSION: ${{ github.event.inputs.nextDevVersion }} |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - id: checkout |
| 22 | + uses: actions/checkout@v2 |
| 23 | + - id: cache-node |
| 24 | + name: Cache node modules |
| 25 | + uses: actions/cache@v2 |
| 26 | + with: |
| 27 | + path: | |
| 28 | + '**/node' |
| 29 | + '**/node_modules' |
| 30 | + ~/.m2/repository |
| 31 | + key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package.json') }} |
| 32 | + - id: setup |
| 33 | + name: Set up JDK 11 |
| 34 | + uses: actions/setup-java@v2 |
| 35 | + with: |
| 36 | + java-version: '11' |
| 37 | + distribution: 'adopt' |
| 38 | + - id: git |
| 39 | + name: Set GIT username and email |
| 40 | + run: | |
| 41 | + git config --global user.email "${{ secrets.GIT_MAIL }}" |
| 42 | + git config --global user.name "${{ secrets.GIT_USER }}" |
| 43 | + - id: create_settings_xml |
| 44 | + name: "Create settings.xml" |
| 45 | + uses: whelk-io/maven-settings-xml-action@v18 |
| 46 | + with: |
| 47 | + repositories: > |
| 48 | + [ |
| 49 | + { |
| 50 | + "id": "central", |
| 51 | + "url": "http://central", |
| 52 | + "releases": { |
| 53 | + "enabled": "true" |
| 54 | + }, |
| 55 | + "snapshots": { |
| 56 | + "enabled": "true" |
| 57 | + } |
| 58 | + } |
| 59 | + ] |
| 60 | + plugin_repositories: > |
| 61 | + [ |
| 62 | + { |
| 63 | + "id": "central", |
| 64 | + "url": "http://central", |
| 65 | + "releases": { |
| 66 | + "enabled": "true" |
| 67 | + }, |
| 68 | + "snapshots": { |
| 69 | + "enabled": "true" |
| 70 | + } |
| 71 | + } |
| 72 | + ] |
| 73 | + servers: > |
| 74 | + [ |
| 75 | + { |
| 76 | + "id": "${{ secrets.NEXUS_ID }}", |
| 77 | + "username": "${{ secrets.NEXUS_USER }}", |
| 78 | + "password": "${{ secrets.NEXUS_USER_PW }}" |
| 79 | + } |
| 80 | + ] |
| 81 | + mirrors: > |
| 82 | + [ |
| 83 | + { |
| 84 | + "id": "${{ secrets.NEXUS_ID }}", |
| 85 | + "mirrorOf": "central", |
| 86 | + "url": "${{ secrets.NEXUS_URL }}" |
| 87 | + } |
| 88 | + ] |
| 89 | + - name: Cache node modules |
| 90 | + uses: actions/cache@v2 |
| 91 | + env: |
| 92 | + cache-name: cache-node-modules |
| 93 | + with: |
| 94 | + path: | |
| 95 | + ~/.node |
| 96 | + ~/.node_modules |
| 97 | + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
| 98 | + restore-keys: | |
| 99 | + ${{ runner.os }}-build-${{ env.cache-name }}- |
| 100 | + ${{ runner.os }}-build- |
| 101 | + ${{ runner.os }}- |
| 102 | + - id: project_artifact_id |
| 103 | + name: Extract Maven project artifactId |
| 104 | + run: echo ::set-output name=artifactId::$(mvn -q -Dexec.executable=echo -Dexec.args='${project.artifactId}' --non-recursive exec:exec) |
| 105 | + - id: write_release_versions |
| 106 | + name: Update versions to ${{ env.RELEASE_VERSION }} |
| 107 | + run: | |
| 108 | + mvn validate -P write-release-versions -Dreplace.target.version=${{ env.RELEASE_VERSION }} |
| 109 | + mvn versions:set -DnewVersion=${{ env.RELEASE_VERSION }} -DgenerateBackupPoms=false |
| 110 | + mvn scm:checkin -DpushChanges=false -Dmessage="[update-version] to ${{ env.RELEASE_VERSION }}" -Dscm.username=${{ secrets.GIT_USER }} -Dscm.password=${{ secrets.RELEASE_TOKEN }} |
| 111 | + - id: tests |
| 112 | + name: Run tests |
| 113 | + run: mvn prepare-package -Prun-js-tests,include-mapapps-deps |
| 114 | + - id: nexus_deployment |
| 115 | + name: Publish to Nexus |
| 116 | + run: mvn deploy -Pcompress -Dmaven.test.skip.exec=true -Ddist.releases.id=${{ secrets.NEXUS_ID }} -Ddist.releases.url=${{ secrets.NEXUS_URL_RELEASE }} -Ddist.snapshots.id=${{ secrets.NEXUS_ID }} -Ddist.snapshots.url=${{ secrets.NEXUS_URL_SNAPSHOTS }} |
| 117 | + - id: release |
| 118 | + name: Create GitHub release |
| 119 | + uses: ncipollo/release-action@v1 |
| 120 | + with: |
| 121 | + artifacts: "target/${{ steps.project_artifact_id.outputs.artifactId }}-bundle.zip,target/${{ steps.project_artifact_id.outputs.artifactId }}-sample-app.zip" |
| 122 | + preRelease: false |
| 123 | + bodyFile: "RELEASE.md" |
| 124 | + allowUpdates: true |
| 125 | + replacesArtifacts: true |
| 126 | + tag: ${{ env.RELEASE_VERSION }} |
| 127 | + token: ${{ secrets.RELEASE_TOKEN }} |
| 128 | + - id: write_dev_versions |
| 129 | + name: Update versions to ${{ env.NEXT_DEV_VERSION }} |
| 130 | + run: | |
| 131 | + mvn validate -P write-release-versions -Dreplace.target.version=${{ env.NEXT_DEV_VERSION }} |
| 132 | + mvn versions:set -DnewVersion=${{ env.NEXT_DEV_VERSION }} -DgenerateBackupPoms=false |
| 133 | + mvn scm:checkin -DpushChanges=true -Dmessage="[update-version] to ${{ env.NEXT_DEV_VERSION }}" -Dscm.username=${{ secrets.GIT_USER }} -Dscm.password=${{ secrets.RELEASE_TOKEN }} |
0 commit comments