Add .gitlab-ci.yml

This commit is contained in:
jas35484
2022-01-16 19:41:32 -06:00
parent 477fa974ea
commit 78670ed537
+52 -28
View File
@@ -8,39 +8,63 @@
# https://gradle.org/
# https://github.com/gradle/gradle
#image: gradle:alpine
image: gradle:eclipse-temurin
# Disable the Gradle daemon for Continuous Integration servers as correctness
# is usually a priority over speed in CI environments. Using a fresh
# runtime for each build is more reliable since the runtime is completely
# isolated from any previous builds.
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
GIT_SUBMODULE_STRATEGY: recursive
# Disable the Gradle daemon for Continuous Integration servers as correctness
# is usually a priority over speed in CI environments. Using a fresh
# runtime for each build is more reliable since the runtime is completely
# isolated from any previous builds.
#GRADLE_OPTS: "-Dorg.gradle.daemon=false"
GIT_SUBMODULE_STRATEGY: recursive
before_script:
- export GRADLE_USER_HOME=`pwd`
#- apt-get update && apt-get -y install openjdk-8-jdk && apt-get -y install ant
- echo $CI_JOB_ID
# Writing GE_JOB_ID variable to environment file, will need the value in the next stage.
- echo GE_JOB_ID=$CI_JOB_ID >> generate_jars.env
build:
stage: build
script: ./gradlew build
image: eclipse-temurin:17
cache:
key: "$CI_COMMIT_REF_NAME"
policy: push
paths:
- build
- .gradle
- .
stage: build
script: ./gradlew build
# the number here is the JDK version
image: eclipse-temurin:17
cache:
key: "$CI_COMMIT_REF_NAME"
policy: push
paths:
- build
- .gradle
- .
artifacts:
paths:
# relative to the root directory
- fabric/build/libs
- forge/build/libs
reports:
# To ensure we've access to this file in the next stage
dotenv: generate_jars.env
#test:
# stage: test
# script: gradle check
# cache:
# key: "$CI_COMMIT_REF_NAME"
# policy: pull
# paths:
# - build
# - .gradle
deploy:
stage: deploy
image: registry.gitlab.com/gitlab-org/release-cli:latest
script:
- echo 'running release_job'
- echo 'Previous Job ID is printed below'
- echo $GE_JOB_ID
# Specifying that this job requires artifacts from the previous job to succeed
needs:
- job: build
artifacts: true
release:
name: 'Release Jars $CI_COMMIT_SHORT_SHA'
description: 'Created using the release-cli'
# tag_name is a mendatory field and can not be an empty string
tag_name: '$CI_COMMIT_SHORT_SHA'
assets:
links:
- name: 'Fabric Jars'
url: 'https://gitlab.com/jeseibel/minecraft-lod-mod/cw/-/jobs/${GE_JOB_ID}/artifacts/file/fabric/build/libs'
- name: 'Forge Jars'
url: 'https://gitlab.com/jeseibel/minecraft-lod-mod/cw/-/jobs/${GE_JOB_ID}/artifacts/file/forge/build/libs'