Perform Release #17
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.15 | |
jobs: | |
build: | |
name: Perform release | |
env: | |
ENVIRONMENT: CI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.RELEASE_BRANCH }} | |
ssh-key: ${{ secrets.SSH_RELEASE_KEY }} | |
- 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: Setup release SSH key | |
uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- 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/[.]$//) | |
echo "CUR_VER=$CUR_VER" >> "$GITHUB_ENV" | |
mvn -DskipTests clean javadoc:javadoc install | |
mvn --batch-mode -Darguments=-DskipTests -Dtag=$CUR_VER release:prepare release:perform -DreleaseVersion=$CUR_VER -DdevelopmentVersion=$NEXT_VER -Dresume=false | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | |
GITHUB_ACTOR: ${{ github.actor }} | |
GITHUB_TOKEN: ${{ github.token }} | |
CI: true | |
- name: Publish image to quay.io | |
run: | | |
IMAGE_TAG=$(docker images | awk '{print $2}' | awk 'NR==2') | |
docker tag quay.io/hyperfoil/horreum:$IMAGE_TAG quay.io/hyperfoil/horreum:${{ env.CUR_VER }} | |
docker tag quay.io/hyperfoil/horreum:${{ env.CUR_VER }} quay.io/hyperfoil/horreum:latest | |
docker push quay.io/hyperfoil/horreum:${{ env.CUR_VER }} | |
docker push quay.io/hyperfoil/horreum:latest |