Skip to content
This repository was archived by the owner on Jul 5, 2025. It is now read-only.

Commit aae2a29

Browse files
Merge pull request #68 from jonathan-robertson/update-pipeline
Update Build Pipeline to Support Recent 7DTD Updates
2 parents 35c230b + df4cee6 commit aae2a29

19 files changed

+314
-109
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: 🚀 Automatic Release
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types: [closed]
8+
9+
env:
10+
SUPPORTED_SERVER_VERSIONS: "1.4-b8 1.3-b9" # space-delimited
11+
SUBFOLDER: ${{ github.event.repository.name }}
12+
PROJECT_FOLDER: src
13+
14+
jobs:
15+
release:
16+
if: ${{ github.event.pull_request.merged }}
17+
runs-on: ubuntu-22.04
18+
permissions:
19+
contents: write
20+
steps:
21+
- name: 🚚 Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: 🔍 Inspect contents
25+
run: |
26+
version=$(sed -n '/Version/{s/.*<Version value=\"\(.*\)\"[ ]*\/>.*/\1/;p}' ModInfo.xml)
27+
if gh release view "$version" > /dev/null 2>&1; then
28+
echo "Release $version already exists; please update ModInfo.xml and create another pull request"
29+
exit 1
30+
fi
31+
echo "MOD_VERSION=$version" >> $GITHUB_ENV
32+
33+
prerelease=$([[ $version = 0* ]] && echo "true" || echo "false")
34+
echo "PRERELEASE=$prerelease" >> $GITHUB_ENV
35+
36+
csproj_path=$(sed -n 's/.*"[^"]*\\\([^"]*\.csproj\)".*/\1/p' ${{ github.event.repository.name }}.sln)
37+
echo "CSPROJ_NAME=$csproj_path" >> $GITHUB_ENV
38+
39+
dll_name=$(sed -n '/AssemblyName/{s/.*<AssemblyName>\(.*\)<\/AssemblyName>.*/\1/;p}' ${{ env.PROJECT_FOLDER }}/$csproj_path)
40+
echo "DLL_NAME=$dll_name" >> $GITHUB_ENV
41+
42+
- name: 🚛 Checkout 7dtd-references
43+
uses: actions/checkout@v4
44+
with:
45+
repository: "${{ github.repository_owner }}/7dtd-references"
46+
token: "${{ secrets.REFERENCES_TOKEN }}"
47+
path: "7dtd-references"
48+
49+
- name: 🧐 Install mono
50+
run: |
51+
sudo apt-get update
52+
sudo apt-get install -y mono-complete
53+
54+
- name: 🛻 Restore NuGet packages
55+
run: |
56+
nuget restore ${{ github.event.repository.name }}.sln
57+
58+
- name: 📦 Build and package artifacts
59+
run: |
60+
cp ${{ env.PROJECT_FOLDER }}/ModApi.cs ${{ env.PROJECT_FOLDER }}/ModApi.cs.bak
61+
for GAME_VERSION in ${{ env.SUPPORTED_SERVER_VERSIONS }}; do
62+
echo "building and packing mod for 7DTD version $GAME_VERSION"
63+
64+
# update release and target versions
65+
cp ${{ env.PROJECT_FOLDER }}/ModApi.cs.bak ${{ env.PROJECT_FOLDER }}/ModApi.cs
66+
sed -i "s|DLL_VERSION = \"test-version\"|DLL_VERSION = \"${{ env.MOD_VERSION }}\"|g" ${{ env.PROJECT_FOLDER }}/ModApi.cs
67+
sed -i "s|BUILD_TARGET = \"test-target\"|BUILD_TARGET = \"$GAME_VERSION\"|g" ${{ env.PROJECT_FOLDER }}/ModApi.cs
68+
69+
# TODO: update assembly info
70+
71+
72+
# update reference paths
73+
sed -i "s|<HintPath>..\\\\..\\\\..\\\\..\\\\..\\\\..\\\\Program Files (x86)\\\\Steam\\\\steamapps\\\\common\\\\7 Days to Die Dedicated Server|<HintPath>..\\\\7dtd-references\\\\${GAME_VERSION}|g" ${{ env.PROJECT_FOLDER }}/${{ env.CSPROJ_NAME }}
74+
75+
# uncomment if troubleshooting becomes necessary
76+
# echo "${{ env.PROJECT_FOLDER }}/${{ env.CSPROJ_NAME }} references were modified to the following:"
77+
# cat "${{ env.PROJECT_FOLDER }}/${{ env.CSPROJ_NAME }}"
78+
79+
msbuild ${{ github.event.repository.name }}.sln /p:Configuration=Release
80+
if [ $? -ne 0 ]; then
81+
echo "build for $GAME_VERSION failed and will be skipped"
82+
continue
83+
else
84+
echo "build for $GAME_VERSION was successful"
85+
fi
86+
87+
mkdir "${{ env.SUBFOLDER }}"
88+
cp -r Config "${{ env.SUBFOLDER }}/"
89+
cp ModInfo.xml "${{ env.SUBFOLDER }}/"
90+
cp README.md "${{ env.SUBFOLDER }}/"
91+
cp CHANGELOG.md "${{ env.SUBFOLDER }}/"
92+
cp "${{ env.DLL_NAME }}.dll" "${{ env.SUBFOLDER }}/"
93+
zip -r "${{ github.event.repository.name }}-${{ env.MOD_VERSION }}-7dtd-$GAME_VERSION.zip" "${{ env.SUBFOLDER }}"
94+
rm -rf "${{ env.SUBFOLDER }}"
95+
done
96+
if ! ls *.zip > /dev/null 2>&1; then
97+
echo "could not successfully build for any of the supported versions of 7 days to die"
98+
exit 1
99+
fi
100+
101+
- name: 📰 Post new release
102+
uses: ncipollo/release-action@v1
103+
with:
104+
tag: ${{ env.MOD_VERSION }}
105+
commit: main
106+
name: ${{ github.event.pull_request.title }}
107+
body: ${{ github.event.pull_request.body }}
108+
generateReleaseNotes: true
109+
artifacts: "*.zip"
110+
prerelease: ${{ env.PRERELEASE }}
111+
# if you'd like to review the generated release before publishing it, enable draft mode
112+
# draft: true
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: 📦 Pack and Attach Artifact
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_tag:
7+
description: 'Tag of the existing release'
8+
required: true
9+
type: string
10+
server_version:
11+
description: '7DTD Server Version'
12+
required: true
13+
default: '1.4-b8'
14+
type: choice
15+
options:
16+
- '1.4-b8'
17+
- '1.3-b9'
18+
19+
permissions:
20+
contents: write
21+
22+
23+
# NOTE: in `run` steps, all 3 of these options are valid ways to reference these env vars:
24+
# ${{ env.MOD_VERSION }}
25+
# ${MOD_VERSION}
26+
# $MOD_VERSION
27+
env:
28+
PROJECT_FOLDER: src
29+
MOD_VERSION: ${{ github.event.inputs.release_tag }}
30+
GAME_VERSION: "${{ github.event.inputs.server_version }}"
31+
ARCHIVE_NAME: ${{ github.event.repository.name }}-${{ github.event.inputs.release_tag }}-7dtd-${{ github.event.inputs.server_version }}
32+
SUBFOLDER: ${{ github.event.repository.name }}
33+
34+
jobs:
35+
build:
36+
runs-on: ubuntu-22.04
37+
38+
steps:
39+
- name: 🚚 Checkout repository
40+
uses: actions/checkout@v4
41+
with:
42+
ref: "${{ env.MOD_VERSION }}"
43+
44+
- name: 🔍 Inspect contents
45+
run: |
46+
gh release view "${{ env.MOD_VERSION }}" || { echo "Release named '${{ env.MOD_VERSION }}' not found; please target a tag with an existing Release."; exit 1; }
47+
48+
csproj_path=$(sed -n 's/.*"[^"]*\\\([^"]*\.csproj\)".*/\1/p' ${{ github.event.repository.name }}.sln)
49+
echo "CSPROJ_NAME=$csproj_path" >> $GITHUB_ENV
50+
51+
dll_name=$(sed -n '/AssemblyName/{s/.*<AssemblyName>\(.*\)<\/AssemblyName>.*/\1/;p}' ${{ env.PROJECT_FOLDER }}/$csproj_path)
52+
echo "DLL_NAME=$dll_name" >> $GITHUB_ENV
53+
env:
54+
GH_TOKEN: ${{ github.token }}
55+
56+
- name: 🚛 Checkout 7dtd-references
57+
uses: actions/checkout@v4
58+
with:
59+
repository: "${{ github.repository_owner }}/7dtd-references"
60+
token: "${{ secrets.REFERENCES_TOKEN }}"
61+
path: "7dtd-references"
62+
63+
- name: 📝 Update ModInfo.xml version and project references
64+
run: |
65+
# update ModInfo version to match tag (in case updating it in source was forgotten)
66+
sed -i "s|<Version value=\"[^\"]*\" />|<Version value=\"{${{ env.MOD_VERSION }}}\" />|" ModInfo.xml
67+
68+
# update release and target versions
69+
sed -i "s|DLL_VERSION = \"test-version\"|DLL_VERSION = \"${{ env.MOD_VERSION }}\"|g" ${{ env.PROJECT_FOLDER }}/ModApi.cs
70+
sed -i "s|BUILD_TARGET = \"test-target\"|BUILD_TARGET = \"$GAME_VERSION\"|g" ${{ env.PROJECT_FOLDER }}/ModApi.cs
71+
72+
# TODO: update assembly info
73+
74+
75+
# update reference paths
76+
sed -i "s|<HintPath>..\\\\..\\\\..\\\\..\\\\..\\\\..\\\\Program Files (x86)\\\\Steam\\\\steamapps\\\\common\\\\7 Days to Die Dedicated Server|<HintPath>..\\\\7dtd-references\\\\${GAME_VERSION}|g" ${{ env.PROJECT_FOLDER }}/${{ env.CSPROJ_NAME }}
77+
78+
echo "${{ env.PROJECT_FOLDER }}/${{ env.CSPROJ_NAME }} references were modified to the following:"
79+
cat "${{ env.PROJECT_FOLDER }}/${{ env.CSPROJ_NAME }}"
80+
81+
- name: 🧐 Install mono
82+
run: |
83+
sudo apt-get update
84+
sudo apt-get install -y mono-complete
85+
86+
- name: 🛻 Restore NuGet packages
87+
run: |
88+
nuget restore ${{ github.event.repository.name }}.sln
89+
90+
- name: 📦 Build and package artifact
91+
run: |
92+
msbuild ${{ github.event.repository.name }}.sln /p:Configuration=Release
93+
mkdir "${{ env.SUBFOLDER }}"
94+
cp -r Config "${{ env.SUBFOLDER }}/"
95+
cp ModInfo.xml "${{ env.SUBFOLDER }}/"
96+
cp README.md "${{ env.SUBFOLDER }}/"
97+
cp CHANGELOG.md "${{ env.SUBFOLDER }}/"
98+
cp "${{ env.DLL_NAME }}.dll" "${{ env.SUBFOLDER }}/"
99+
zip -r "${{ env.ARCHIVE_NAME }}.zip" "${{ env.SUBFOLDER }}"
100+
ls -alr
101+
102+
- name: ⬆️ Upload artifact
103+
uses: actions/upload-artifact@v4
104+
with:
105+
name: ${{ env.ARCHIVE_NAME }}
106+
path: ${{ env.ARCHIVE_NAME }}.zip
107+
108+
- name: 📋 Attach artifact
109+
uses: softprops/action-gh-release@v2
110+
with:
111+
tag_name: ${{ env.MOD_VERSION }}
112+
files: ${{ env.ARCHIVE_NAME }}.zip

.github/workflows/release.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.gitignore

Lines changed: 70 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
*.dll
12

2-
# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,visualstudiocode,csharp,git
3-
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,visualstudiocode,csharp,git
3+
# Created by https://www.toptal.com/developers/gitignore/api/windows,macos,linux,visualstudio,visualstudiocode,git,csharp
4+
# Edit at https://www.toptal.com/developers/gitignore?templates=windows,macos,linux,visualstudio,visualstudiocode,git,csharp
45

56
### Csharp ###
67
## Ignore Visual Studio temporary files, build results, and
@@ -415,6 +416,53 @@ FodyWeavers.xsd
415416
*_LOCAL_*.txt
416417
*_REMOTE_*.txt
417418

419+
### Linux ###
420+
421+
# temporary files which can be created if a process still has a handle open of a deleted file
422+
.fuse_hidden*
423+
424+
# KDE directory preferences
425+
.directory
426+
427+
# Linux trash folder which might appear on any partition or disk
428+
.Trash-*
429+
430+
# .nfs files are created when an open file is removed but is still being accessed
431+
.nfs*
432+
433+
### macOS ###
434+
# General
435+
.DS_Store
436+
.AppleDouble
437+
.LSOverride
438+
439+
# Icon must end with two \r
440+
Icon
441+
442+
443+
# Thumbnails
444+
._*
445+
446+
# Files that might appear in the root of a volume
447+
.DocumentRevisions-V100
448+
.fseventsd
449+
.Spotlight-V100
450+
.TemporaryItems
451+
.Trashes
452+
.VolumeIcon.icns
453+
.com.apple.timemachine.donotpresent
454+
455+
# Directories potentially created on remote AFP share
456+
.AppleDB
457+
.AppleDesktop
458+
Network Trash Folder
459+
Temporary Items
460+
.apdisk
461+
462+
### macOS Patch ###
463+
# iCloud generated files
464+
*.icloud
465+
418466
### VisualStudioCode ###
419467
!.vscode/*.code-snippets
420468

@@ -428,10 +476,26 @@ FodyWeavers.xsd
428476
.history
429477
.ionide
430478

431-
# Support for Project snippet scope
432-
.vscode/*.code-snippets
479+
### Windows ###
480+
# Windows thumbnail cache files
481+
Thumbs.db
482+
Thumbs.db:encryptable
483+
ehthumbs.db
484+
ehthumbs_vista.db
485+
486+
# Dump file
487+
*.stackdump
488+
489+
# Folder config file
490+
[Dd]esktop.ini
491+
492+
# Recycle Bin used on file shares
493+
$RECYCLE.BIN/
494+
495+
# Windows Installer files
433496

434-
# Ignore code-workspaces
497+
# Windows shortcuts
498+
*.lnk
435499

436500
### VisualStudio ###
437501

@@ -614,4 +678,4 @@ FodyWeavers.xsd
614678
### VisualStudio Patch ###
615679
# Additional files built by Visual Studio
616680

617-
# End of https://www.toptal.com/developers/gitignore/api/visualstudio,visualstudiocode,csharp,git
681+
# End of https://www.toptal.com/developers/gitignore/api/windows,macos,linux,visualstudio,visualstudiocode,git,csharp

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [5.0.1] - 2025-04-11
9+
10+
- rebuilt mod for 7dtd 1.4 (b8)
11+
- update pipeline to build multiple versions
12+
813
## [5.0.0] - 2025-02-15
914

1015
- update references for 7dtd-1.3-b9

ModInfo.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<DisplayName value="Quantum Elevators" />
55
<!-- REMINDER: this mod's DLL version will be logged on GameAwake and should reflect the same version listed here! -->
66
<!-- If troubleshooting an issue, search "Quantum Elevators DLL" in logs to confirm these two values match. -->
7-
<Version value="5.0.0" />
7+
<Version value="5.0.1" />
88
<Description value="Add infinite distance, vertical-warp elevator panels." />
99
<Author value="Jonathan Robertson (Kanaverum)" />
1010
<Website value="https://github.com/jonathan-robertson/quantum-elevators" />

QuantumElevators.dll

-28.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)