-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
.gitlab-ci.yml
83 lines (78 loc) · 2.89 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
stages:
- build
- package
- deploy
variables:
MAJOR_VERSION: "2"
MINOR_VERSION: "3"
BUILD_VERSION: "${CI_PIPELINE_IID}"
VERSION: ${MAJOR_VERSION}.${MINOR_VERSION}.${BUILD_VERSION}
build:
rules:
- if: $CI_PIPELINE_SOURCE == "web"
when: always
variables:
OBJECTS_DIRECTORY: 'obj'
NUGET_PACKAGES_DIRECTORY: '.nuget'
SOURCE_CODE_PATH: 'TheOtherRoles/'
cache:
key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
paths:
- '$SOURCE_CODE_PATH$OBJECTS_DIRECTORY/project.assets.json'
- '$SOURCE_CODE_PATH$OBJECTS_DIRECTORY/*.csproj.nuget.*'
- '$NUGET_PACKAGES_DIRECTORY'
policy: pull-push
image: haoming37/plugin_build
stage: build
script:
- ln -s /usr/bin/python3 /usr/bin/py
- sed -i "s/999.999.999/${VERSION}/" TheOtherRoles/TheOtherRoles.csproj
- sed -i "s/999.999.999/${VERSION}/" TheOtherRoles/Main.cs
- dotnet restore --packages $NUGET_PACKAGES_DIRECTORY /p:GamePlatform=Steam
- dotnet build --configuration Release --no-restore /p:GamePlatform=Steam
- mv ${SOURCE_CODE_PATH}/obj/Release/netstandard2.1/TheOtherRolesGM.dll ${CI_PROJECT_DIR}
artifacts:
name: "TheOtherRoles-GM-H-dll-v${VERSION}"
paths:
- TheOtherRolesGM.dll
package:
rules:
- if: $CI_PIPELINE_SOURCE == "web"
when: always
image: haoming37/alpine_curl_zip_git_jq_file
dependencies:
- build
stage: package
script:
- curl -LO https://builds.bepinex.dev/projects/bepinex_be/570/BepInEx_UnityIL2CPP_x86_3febd6a_6.0.0-be.570.zip
- mkdir TheOtherRoles-GM-Haoming
- unzip BepInEx_UnityIL2CPP_x86_3febd6a_6.0.0-be.570.zip -d TheOtherRoles-GM-Haoming
- mkdir -p TheOtherRoles-GM-Haoming/BepinEx/plugins
- mkdir -p TheOtherRoles-GM-Haoming/TheOtherHats/Test
- cp CICD/TestHat.png TheOtherRoles-GM-Haoming/TheOtherHats/Test/
- cp CICD/steam_appid.txt TheOtherRoles-GM-Haoming/
- mv TheOtherRolesGM.dll TheOtherRoles-GM-Haoming/BepinEx/plugins
#- curl -L https://github.com/SubmergedAmongUs/Submerged/releases/download/v2022.5.8/Submerged.dll -o TheOtherRoles-GM-Haoming/BepinEx/plugins/Submerged.dll
- cd TheOtherRoles-GM-Haoming
- zip -r ../TheOtherRoles-GM-Haoming.v${VERSION}.zip *
artifacts:
name: "TheOtherRoles-GM-Haoming.v${VERSION}"
paths:
- TheOtherRoles-GM-Haoming.v${VERSION}.zip
deploy:
rules:
- if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_REF_NAME == "haoming-main"
when: manual
image: haoming37/alpine_curl_zip_git_jq_file
dependencies:
- build
- package
stage: deploy
script:
- git config checkout.defaultRemote origin
- git remote add github https://haoming37:${GitHub_TOKEN}@github.com/haoming37/TheOtherRoles-GM-Haoming.git
- git fetch github haoming-main
- git fetch origin ${CI_COMMIT_REF_NAME}
- git checkout haoming-main && git reset --hard origin/${CI_COMMIT_REF_NAME}
- git push github haoming-main
- ./CICD/create_release.sh