Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update build pipeline #616

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/[email protected]
with:
Expand All @@ -29,6 +35,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 +61,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