|
| 1 | +name: devnet-bundle-snapshot |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - id: checkout |
| 14 | + uses: actions/checkout@v2 |
| 15 | + - id: cache-node |
| 16 | + name: Cache node modules |
| 17 | + uses: actions/cache@v2 |
| 18 | + with: |
| 19 | + path: | |
| 20 | + '**/node' |
| 21 | + '**/node_modules' |
| 22 | + ~/.m2/repository |
| 23 | + key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package.json') }} |
| 24 | + - id: setup |
| 25 | + name: Set up JDK 11 |
| 26 | + uses: actions/setup-java@v2 |
| 27 | + with: |
| 28 | + java-version: '11' |
| 29 | + distribution: 'adopt' |
| 30 | + - id: create_settings_xml |
| 31 | + name: Create settings.xml |
| 32 | + uses: whelk-io/maven-settings-xml-action@v18 |
| 33 | + with: |
| 34 | + repositories: > |
| 35 | + [ |
| 36 | + { |
| 37 | + "id": "central", |
| 38 | + "url": "http://central", |
| 39 | + "releases": { |
| 40 | + "enabled": "true" |
| 41 | + }, |
| 42 | + "snapshots": { |
| 43 | + "enabled": "true" |
| 44 | + } |
| 45 | + } |
| 46 | + ] |
| 47 | + plugin_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 | + servers: > |
| 61 | + [ |
| 62 | + { |
| 63 | + "id": "${{ secrets.NEXUS_ID }}", |
| 64 | + "username": "${{ secrets.NEXUS_USER }}", |
| 65 | + "password": "${{ secrets.NEXUS_USER_PW }}" |
| 66 | + } |
| 67 | + ] |
| 68 | + mirrors: > |
| 69 | + [ |
| 70 | + { |
| 71 | + "id": "${{ secrets.NEXUS_ID }}", |
| 72 | + "mirrorOf": "central", |
| 73 | + "url": "${{ secrets.NEXUS_URL }}" |
| 74 | + } |
| 75 | + ] |
| 76 | + - name: Cache node modules |
| 77 | + uses: actions/cache@v2 |
| 78 | + env: |
| 79 | + cache-name: cache-node-modules |
| 80 | + with: |
| 81 | + path: | |
| 82 | + ~/.node |
| 83 | + ~/.node_modules |
| 84 | + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
| 85 | + restore-keys: | |
| 86 | + ${{ runner.os }}-build-${{ env.cache-name }}- |
| 87 | + ${{ runner.os }}-build- |
| 88 | + ${{ runner.os }}- |
| 89 | + - id: project_version |
| 90 | + name: Extract Maven project version |
| 91 | + run: echo ::set-output name=version::$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) |
| 92 | + - id: project_artifact_id |
| 93 | + name: Extract Maven project artifactId |
| 94 | + run: echo ::set-output name=artifactId::$(mvn -q -Dexec.executable=echo -Dexec.args='${project.artifactId}' --non-recursive exec:exec) |
| 95 | + - id: tests |
| 96 | + name: Run tests |
| 97 | + run: mvn prepare-package -Prun-js-tests,include-mapapps-deps |
| 98 | + - id: nexus_deployment |
| 99 | + name: Publish to Nexus |
| 100 | + 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 }} |
| 101 | + - id: release |
| 102 | + name: Create GitHub release |
| 103 | + uses: ncipollo/release-action@v1 |
| 104 | + with: |
| 105 | + artifacts: "target/${{ steps.project_artifact_id.outputs.artifactId }}-bundle.zip,target/${{ steps.project_artifact_id.outputs.artifactId }}-sample-app.zip" |
| 106 | + preRelease: true |
| 107 | + bodyFile: "RELEASE.md" |
| 108 | + allowUpdates: true |
| 109 | + replacesArtifacts: true |
| 110 | + tag: ${{ steps.project_version.outputs.version }} |
| 111 | + token: ${{ secrets.RELEASE_TOKEN }} |
0 commit comments