maven-release #90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: maven-release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: maven and docker release version | |
required: true | |
default: 'X.X.X.RCX' | |
docker: | |
description: push to docker | |
required: true | |
type: choice | |
options: | |
- 'enabled' | |
- 'disabled' | |
maven: | |
description: push to maven central | |
required: true | |
type: choice | |
options: | |
- 'enabled' | |
- 'disabled' | |
jobs: | |
build: | |
timeout-minutes: 20 | |
runs-on: ubuntu-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v4 | |
- name: set up jdk 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: adopt | |
java-version: 17 | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: set maven version | |
run: | | |
mvn versions:set versions:commit -B -ntp -DnewVersion=${{ github.event.inputs.version }} | |
- name: docker build | |
if: ( github.event.inputs.docker == 'enabled' ) | |
run: | | |
mvn clean install -B -ntp -DskipTests -P pre-release | |
./build-docker.sh | |
- name: docker login | |
if: ( github.event.inputs.docker == 'enabled' ) | |
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: docker push | |
if: ( github.event.inputs.docker == 'enabled' ) | |
run: | | |
docker buildx build --push --platform linux/amd64 --cache-from=type=local,src=./target/docker --cache-to=type=local,dest=./target/docker -t karatelabs/karate-chrome:${{ github.event.inputs.version }} -t karatelabs/karate-chrome:latest karate-docker/karate-chrome | |
docker buildx build --push --platform linux/amd64,linux/arm64 --cache-from=type=local,src=./target/docker --cache-to=type=local,dest=./target/docker -t karatelabs/karate-chromium:${{ github.event.inputs.version }} -t karatelabs/karate-chromium:latest karate-docker/karate-chromium | |
- name: maven deploy to central | |
if: ( github.event.inputs.maven == 'enabled' ) | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSSRH_TOKEN_USER }} | |
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} | |
run: | | |
mvn -B -ntp deploy -DskipTests -P pre-release,release | |
- name: maven build binaries | |
run: | | |
mvn package -DskipTests -P fatjar -f karate-core/pom.xml | |
mvn package -DskipTests -P fatjar -f karate-robot/pom.xml | |
- name: upload binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: karate-release-${{ github.event.inputs.version }} | |
retention-days: 5 | |
path: | | |
karate-core/target/*.jar | |
karate-robot/target/*.jar |