diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 06e443fec..4c024094d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,6 +3,14 @@ on: release: types: [published] workflow_dispatch: + version: + description: 'Build version' + required: true + type: string + skip_tests: + description: 'Skip tests' + required: true + type: boolean env: REGISTRY: ghcr.io @@ -15,9 +23,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/login-action@v3.0.0 with: @@ -29,6 +35,24 @@ jobs: uses: docker/metadata-action@v5.5.1 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/build-push-action@v5.1.0 with: @@ -37,4 +61,5 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | - "VER=${{ github.event.release.name }}" \ No newline at end of file + "VER=${{ steps.configure-build.outputs.version }}" + "SKIP_TESTS=${{ steps.configure-build.outputs.skip-tests }}" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5e9e91eab..6f1279273 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -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