diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..183b30b --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,72 @@ +name: Release + +on: + release: + types: + - published + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Configure Maven + uses: whelk-io/maven-settings-xml-action@v21 + with: + repositories: '[{ "id": "backbase", "url": "https://repo.backbase.com/repo" }]' + plugin_repositories: '[{ "id": "backbase-plugins", "url": "https://repo.backbase.com/repo" }]' + servers: '[{ "id": "backbase", "username": "${{ secrets.MAVEN_USERNAME }}", "password": "${{ secrets.MAVEN_PASSWORD }}" },{ "id": "backbase-plugins", "username": "${{ secrets.MAVEN_USERNAME }}", "password": "${{ secrets.MAVEN_PASSWORD }}" }]' + - name: Cache local Maven repository + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + - name: Maven Verify + run: mvn -B verify --file pom.xml + + publish: + runs-on: ubuntu-latest + needs: [ test ] + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Configure Maven + uses: whelk-io/maven-settings-xml-action@v21 + with: + repositories: '[{ "id": "backbase", "url": "https://repo.backbase.com/repo" }]' + plugin_repositories: '[{ "id": "backbase-plugins", "url": "https://repo.backbase.com/repo" }]' + servers: '[{ "id": "backbase", "username": "${{ secrets.MAVEN_USERNAME }}", "password": "${{ secrets.MAVEN_PASSWORD }}" },{ "id": "backbase-plugins", "username": "${{ secrets.MAVEN_USERNAME }}", "password": "${{ secrets.MAVEN_PASSWORD }}" }]' + - name: Cache local Maven repository + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + - name: Update POM Version + run: | + echo "New version is: ${GITHUB_REF##*/v}" + mvn versions:set -DnewVersion=${GITHUB_REF##*/v} -DgenerateBackupPoms=false -B + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v2.1.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Docker Build + run: mvn clean package jib:build -Djib.to.image=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_REF##*/v} diff --git a/pom.xml b/pom.xml index aacd24a..f5e0bdd 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ com.backbase.testing event-emitter - 1.9.0-SNAPSHOT + 1.0.0-SNAPSHOT war Backbase :: Testing Components :: Events Emitter