generated from jaredlll08/MultiLoader-Template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
102 lines (96 loc) · 4.6 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
stages:
- Tests
- Release
- Build Release
variables:
project_name: "$CI_PROJECT_NAME"
SEMANTIC_RELEASE_PACKAGE: "$CI_PROJECT_NAME"
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
GRADLE_USER_HOME: "$CI_PROJECT_DIR/.gradle"
services:
- name: docker.griefed.dev/griefed/gitlab-ci-cd:2.2.9
alias: docker
workflow:
rules:
- if: '$CI_MERGE_REQUEST_EVENT_TYPE == "detached"'
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: '$CI_COMMIT_TITLE =~ /^RELEASE:.+$/ && $CI_COMMIT_BRANCH' # && $CI_COMMIT_TAG == null
when: never
- when: always
Build Test:
stage: Tests
image: docker.griefed.dev/eclipse-temurin:17-jdk-jammy
before_script:
- echo "**** Running in $CI_JOB_ID ****"
- echo "**** Java location ****"
- which java
- echo "**** Java version ****"
- java -version
- echo "**** Allowing execution of gradlew ****"
- chmod +x gradlew
script:
- echo "**** Building ****"
- "./gradlew clean blockAndItemCodeGen --info --full-stacktrace"
- "./gradlew :Fabric:build --info --full-stacktrace"
- "./gradlew :Forge:build --info --full-stacktrace"
retry: 1
rules:
- if: '$CI_SERVER_HOST == "git.griefed.de"'
artifacts:
when: always
name: "$CI_COMMIT_BRANCH-$CI_COMMIT_SHORT_SHA-$CI_JOB_NAME"
expose_as: "Gradle-Test-Artifacts"
paths:
- Forge/build
- Fabric/build
- Common/build
expire_in: 1 week
Generate Release:
stage: Release
image: docker.griefed.dev/griefed/gitlab-ci-cd:2.2.9
needs:
- job: Build Test
artifacts: false
script:
- npx semantic-release
rules:
- if: '$CI_COMMIT_BRANCH == "alpha" && $CI_COMMIT_TITLE !~ /^RELEASE:.+$/ && $CI_SERVER_HOST == "git.griefed.de"'
- if: '$CI_COMMIT_BRANCH == "beta" && $CI_COMMIT_TITLE !~ /^RELEASE:.+$/ && $CI_SERVER_HOST == "git.griefed.de"'
- if: '$CI_COMMIT_BRANCH == "1.19.2" && $CI_COMMIT_TITLE !~ /^RELEASE:.+$/ && $CI_SERVER_HOST == "git.griefed.de"'
Build Release:
stage: Build Release
image: docker.griefed.dev/eclipse-temurin:17-jdk-jammy
needs:
- job: Build Test
artifacts: false
optional: false
- job: release_job
optional: true
artifacts: false
before_script:
- echo "**** Running in $CI_JOB_ID ****"
- echo "**** Java location ****"
- which java
- echo "**** Java version ****"
- java -version
- echo "**** Allowing execution of gradlew ****"
- chmod +x gradlew
script:
- echo "**** Building ****"
- "./gradlew clean blockAndItemCodeGen --info --full-stacktrace"
- "./gradlew -Pversion=${CI_COMMIT_TAG} :Fabric:build --info --full-stacktrace"
- "./gradlew -Pversion=${CI_COMMIT_TAG} :Forge:build --info --full-stacktrace"
- echo "**** Listing build directory ****"
- LC_COLLATE=C ls -ahl --group-directories-first --color=auto */build
- LC_COLLATE=C ls -ahl --group-directories-first --color=auto */build/*
- echo "**** Uploading packages ****"
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file Forge/build/libs/AddEmAll-forge-1.19.2-${CI_COMMIT_TAG}.jar "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}/${CI_PROJECT_NAME}-forge-1.19.2-${CI_COMMIT_TAG}.jar"'
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file Fabric/build/libs/AddEmAll-fabric-1.19.2-${CI_COMMIT_TAG}.jar "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}/${CI_PROJECT_NAME}-fabric-1.19.2-${CI_COMMIT_TAG}.jar"'
- echo "**** Create asset links ****"
- 'curl --request POST --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" --data tag_name="${CI_COMMIT_TAG}" --data name="${CI_PROJECT_NAME}-forge-1.19.2-${CI_COMMIT_TAG}.jar" --data url="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}/${CI_PROJECT_NAME}-forge-1.19.2-${CI_COMMIT_TAG}.jar" --data link_type="package" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/releases/${CI_COMMIT_TAG}/assets/links"'
- 'curl --request POST --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" --data tag_name="${CI_COMMIT_TAG}" --data name="${CI_PROJECT_NAME}-fabric-1.19.2-${CI_COMMIT_TAG}.jar" --data url="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}/${CI_PROJECT_NAME}-fabric-1.19.2-${CI_COMMIT_TAG}.jar" --data link_type="package" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/releases/${CI_COMMIT_TAG}/assets/links"'
rules:
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+-(alpha|beta)\.\d+$/ && $CI_SERVER_HOST == "git.griefed.de"'
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/ && $CI_SERVER_HOST == "git.griefed.de"'