Skip to content
Snippets Groups Projects
Commit 110920cc authored by Sofiane Lasri's avatar Sofiane Lasri
Browse files

feat: add GitLab CI configuration for build and release stages

parent ce9eaa46
Branches
Tags
No related merge requests found
Pipeline #975 failed
stages:
- build
- release
variables:
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version"
DATE_FORMAT: "%Y%m%d-%H%M%S"
build:
stage: build
image: maven:3.8.7-openjdk-21
script:
- mvn $MAVEN_CLI_OPTS clean package
- BUILD_DATE=$(date -u +${DATE_FORMAT})
- JAR_NAME="PrivateServerPlugin-${BUILD_DATE}.jar"
- mv target/PrivateServerPlugin.jar "${JAR_NAME}"
- echo "BUILD_DATE=${BUILD_DATE}" > build.env
- echo "JAR_NAME=${JAR_NAME}" >> build.env
artifacts:
paths:
- "${JAR_NAME}"
- build.env
expire_in: 1 week
rules:
- if: $CI_COMMIT_BRANCH == "master"
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- job: build
artifacts: true
script:
- source build.env
- echo "Release ${JAR_NAME} created at ${BUILD_DATE}"
release:
name: "Release ${BUILD_DATE}"
tag_name: "release-${BUILD_DATE}"
description: "Version compilée le ${BUILD_DATE} (commit ${CI_COMMIT_SHORT_SHA})"
assets:
links:
- name: "${JAR_NAME}"
url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${CI_JOB_ID}/artifacts/${JAR_NAME}"
rules:
- if: $CI_COMMIT_BRANCH == "master"
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<build> <build>
<defaultGoal>clean package</defaultGoal> <defaultGoal>clean package</defaultGoal>
<finalName>PrivateServerPlugin</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment