Skip to content

V-1.0.8-SNAPSHOT-1

V-1.0.8-SNAPSHOT-1 #79

# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
name: Maven Package
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4 # Setup JDK to use with Maven and set settings.xml for auth to Maven Central
with:
java-version: '21'
distribution: 'liberica'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Build with Maven
run: mvn -B package --file pom.xml -DskipTests
#- name: Publish to the Maven Central Repository
# run: mvn --batch-mode deploy
# env:
# MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
# MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
- name: Set up JDK 21 for GitHub Packages publish
uses: actions/setup-java@v4 # We have to setup JDK a second time to overwrite the settings.xml file for auth to GitHub Packages.
with:
java-version: '21'
distribution: 'liberica'
- name: Publish to GitHub Packages
run: mvn --batch-mode deploy --file pom.xml -DskipTests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
# context: ./
# file: ./Dockerfile
push: true
tags: kdhrubo/db2rest:v${{github.run_number}}, kdhrubo/db2rest:latest