Perform Release #7
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
# This workflow will build and release Horreum to maven central and quay.io. | |
name: Perform Release | |
on: | |
workflow_dispatch: | |
env: | |
RELEASE_BRANCH: 0.14 | |
jobs: | |
build: | |
name: Perform release | |
env: | |
ENVIRONMENT: CI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.RELEASE_BRANCH }} | |
- | |
name: Import GPG key | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
- | |
name: List keys | |
run: gpg -K | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
- name: Maven Version | |
run: mvn --version | |
- name: Authenticate with Quay.io | |
run: echo "${{ secrets.QUAY_IO_PASSWORD }}" | docker login quay.io -u "${{ secrets.QUAY_IO_USERNAME }}" --password-stdin | |
- name: Publish base image | |
run: | | |
docker build -f ./horreum-backend/src/main/docker/Dockerfile.jvm.base -t quay.io/hyperfoil/horreum-base:latest ./horreum-backend/ | |
docker push quay.io/hyperfoil/horreum-base:latest | |
- name: Setup git | |
run: | | |
git config --global user.email "rhappservicesperf@gmail.com" | |
git config --global user.name "rh-appservices-perf" | |
- name: Release to Maven | |
run: | | |
PROJECT_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:3.4.0:evaluate -Dexpression=project.version -q -DforceStdout) | |
CUR_VER=$(echo ${PROJECT_VERSION} | awk -F '-' '{ print $1}' | awk -F'.' '{print $1+0"."$2+0"."$3+0}' | sed s/[.]$//) | |
NEXT_VER=$(echo ${PROJECT_VERSION} | awk -F '-' '{ print $1}' | awk -F'.' '{print $1+0"."$2+0"."$3+1"-SNAPSHOT"}' | sed s/[.]$//) | |
CI=true mvn -DskipTests clean javadoc:javadoc install | |
CI=true mvn --batch-mode -Darguments=-DskipTests -Dtag=$CUR_VER release:prepare -DreleaseVersion=$CUR_VER -DdevelopmentVersion=$NEXT_VER -Dresume=false | |
CI=true mvn --batch-mode -Darguments=-DskipTests release:perform | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | |
- name: Publish image to quay.io | |
run: | | |
PROJECT_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:3.4.0:evaluate -Dexpression=project.version -q -DforceStdout) | |
CUR_VER=$(echo ${PROJECT_VERSION} | awk -F '-' '{ print $1}' | awk -F'.' '{print $1+0"."$2+0"."$3+0}' | sed s/[.]$//) | |
IMAGE_TAG=$(docker images | awk '{print $2}' | awk 'NR==2') | |
docker tag quay.io/hyperfoil/horreum:$IMAGE_TAG quay.io/hyperfoil/horreum:$CUR_VER | |
docker tag quay.io/hyperfoil/horreum:$CUR_VER quay.io/hyperfoil/horreum:latest | |
docker push quay.io/hyperfoil/horreum:$CUR_VER | |
docker push quay.io/hyperfoil/horreum:latest |