Update release workflow #4
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: Latest | |
on: | |
push: | |
tags-ignore: | |
- "**" | |
branches: | |
- "main" | |
env: | |
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version" | |
jobs: | |
continuous-integration: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
cache: 'maven' | |
- name: Set up Maven | |
uses: stCarolas/setup-maven@v5 | |
with: | |
maven-version: 3.9.6 | |
- name: Test | |
run: mvn $MAVEN_CLI_OPTS test | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build library | |
run: mvn $MAVEN_CLI_OPTS clean package -DskipTests | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build CLI | |
run: mvn $MAVEN_CLI_OPTS clean package -Pcli -DskipTests | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload job artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifact | |
path: target/*.jar | |
if-no-files-found: error | |
retention-days: 5 | |
deploy-package: | |
runs-on: ubuntu-latest | |
needs: continuous-integration | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
cache: 'maven' | |
- name: Set up Maven | |
uses: stCarolas/setup-maven@v5 | |
with: | |
maven-version: 3.9.6 | |
- name: Deploy to GitHub packages | |
run: mvn $MAVEN_CLI_OPTS clean deploy -Dmaven.test.skip=true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
deploy-docker: | |
runs-on: ubuntu-latest | |
needs: continuous-integration | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: docker/target | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
#- name: Login to DockerHub container registry | |
# uses: docker/login-action@v3 | |
# with: | |
# username: ${{ secrets.DOCKERHUB_USERNAME }} | |
# password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build | |
uses: docker/build-push-action@v6 | |
with: | |
context: docker | |
push: true | |
tags: | | |
ghcr.io/keeps/commons-ip-cits-siard:latest | |
# keeps/commons-ip-cits-erms | |
sbom: true | |
provenance: mode=max |