Skip to content

Commit

Permalink
chore: update build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
matteo-s committed Oct 25, 2024
1 parent fa0dcf1 commit 48cb04f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
34 changes: 30 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Build version'
required: true
type: string
skip_tests:
description: 'Skip tests'
required: true
type: boolean

env:
REGISTRY: ghcr.io
Expand All @@ -15,9 +24,7 @@ jobs:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'true'
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/[email protected]
with:
Expand All @@ -29,6 +36,24 @@ jobs:
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Configure build
id: configure-build
run: |
if [ ! -z "${{ github.release.name }}" ]; then
echo "release"
echo "version=${{ github.release.name }}" >> "$GITHUB_OUTPUT"
echo "skip-tests=false" >> "$GITHUB_OUTPUT"
elif [ ! -z "${{ github.inputs.version }}" ]; then
echo "manual"
echo "version=${{ github.inputs.version }}" >> "$GITHUB_OUTPUT"
echo "skip-tests=${{ github.inputs.skip_tests }}" >> "$GITHUB_OUTPUT"
else
echo "snapshot"
echo "version=SNAPSHOT" >> "$GITHUB_OUTPUT"
echo "skip-tests=true" >> "$GITHUB_OUTPUT"
fi
outputs:
selected-stage: ${{ steps.select-stage.outputs.selected-stage }}
- name: Build and push Docker image
uses: docker/[email protected]
with:
Expand All @@ -37,4 +62,5 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
"VER=${{ github.event.release.name }}"
"VER=${{ steps.configure-build.outputs.version }}"
"SKIP_TESTS=${{ steps.configure-build.outputs.skip-tests }}"
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM ${CACHE} AS cache

FROM maven:3-openjdk-17 AS build
ARG VER=SNAPSHOT
ARG SKIP_TESTS=false
COPY ./src /tmp/src
COPY ./pom.xml /tmp/pom.xml
COPY ./user-console /tmp/user-console
Expand All @@ -14,7 +15,7 @@ RUN --mount=type=cache,target=/root/.m2,source=/cache/.m2,from=cache \
--mount=type=cache,target=/tmp/user-console/node_modules,source=/cache/user-console/node_modules,from=cache \
--mount=type=cache,target=/tmp/dev-console/node_modules,source=/cache/dev-console/node_modules,from=cache \
--mount=type=cache,target=/tmp/admin-console/node_modules,source=/cache/admin-console/node_modules,from=cache \
mvn -Drevision=${VER} package
mvn -Drevision=${VER} package -DskipTests=${SKIP_TESTS}

FROM eclipse-temurin:17-jdk-alpine AS builder
WORKDIR /tmp
Expand Down

0 comments on commit 48cb04f

Please sign in to comment.