1.4.2 #66
Workflow file for this run
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 a package using Maven and then publish it to Central Portal (Sonatype) | |
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path | |
name: Maven Default Publish | |
on: | |
release: | |
types: [created] | |
jobs: | |
build_and_test: | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout code for Tag | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
- name: Echo Tag | |
run: "echo 'CHECKED OUT TAG: ${{ github.event.release.tag_name }}'" | |
- name: Set up JDK 21 and maven settings.xml | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'liberica' | |
cache: 'maven' | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
server-id: central | |
# TROUBLESHOOTING: We can temporarily skip upload & publishing to Maven Central in here | |
# by setting the `run: mvn` line's last -DskipPublishing property to true | |
- name: Build & Publish package DB2Rest to Central | |
run: mvn --quiet -Drevision=${{ github.event.release.tag_name }} --no-transfer-progress -B deploy -P release -DskipTests -DskipPublishing=false | |
# below we use env for passing GPG stuff since the signing type is bouncy castle (bc) | |
# set in parent pom's maven-gpg-plugin configuration and doesn't need gpg agent. | |
env: | |
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
MAVEN_GPG_KEY: ${{ secrets.MAVEN_GPG_KEY }} | |
# we unzip the central-bundle.zip so that we can access | |
# the db2rest JAR file path easily for Docker image build | |
- name: Unzip the central-bundle.zip & output JAR_FILE | |
id: unzip | |
run: | | |
mkdir staging | |
cp target/central-publishing/central-bundle.zip staging | |
unzip staging/central-bundle.zip -d staging | |
echo "JAR_FILE=staging/io/9tiger/db2rest/${{ github.event.release.tag_name }}/db2rest-${{ github.event.release.tag_name}}.jar" >> $GITHUB_ENV | |
- run: ls staging/io/9tiger/db2rest/${{ github.event.release.tag_name }} | |
- run: ls ${{ env.JAR_FILE }} | |
- name: Archive central-bundle JAR artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
path: staging/central-bundle.zip | |
# - name: Build & Publish package Oracle9i to Central | |
# run: mvn -Drevision=${{ github.event.release.tag_name }} --no-transfer-progress -B deploy -P release --file api-rest/pom-oracle9i.xml -DskipTests | |
# env: | |
# MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
# MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
# MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
# MAVEN_GPG_KEY: ${{ secrets.MAVEN_GPG_KEY }} | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: "${{ github.workspace }}" | |
push: true | |
tags: kdhrubo/db2rest:v${{ github.event.release.tag_name }}, kdhrubo/db2rest:latest | |
build-args: | | |
JAR_FILE=${{ env.JAR_FILE }} |