Files
LuaCsForBarotraumaEP/.github/workflows/publish-release.yml
dependabot[bot] f08ec51640 Bump notpeelz/action-gh-create-release from 1.0.2 to 4.0.0
Bumps [notpeelz/action-gh-create-release](https://github.com/notpeelz/action-gh-create-release) from 1.0.2 to 4.0.0.
- [Release notes](https://github.com/notpeelz/action-gh-create-release/releases)
- [Commits](a3caaff31c...35fc26709d)

---
updated-dependencies:
- dependency-name: notpeelz/action-gh-create-release
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-27 16:27:13 -03:00

157 lines
5.0 KiB
YAML

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Publish release
on:
workflow_dispatch:
workflow_call:
env:
CI_DIR: 2049ef39-42a2-46d2-b513-ee6d2e3a7b15
RELEASES: |
windows:client:Windows/Client
windows:server:Windows/Server
linux:client:Linux/Client
linux:server:Linux/Server
mac:client:Mac/Client/Barotrauma.app/Contents/MacOS
mac:server:Mac/Server
ARCHIVE_BASE_NAME: luacsforbarotrauma
# XXX: these file names are subject to shell expansion.
# Be careful when using special characters.
ARCHIVE_FILES_SERVER: |
DedicatedServer.deps.json
DedicatedServer.dll
DedicatedServer.pdb
Publicized/DedicatedServer.dll
ARCHIVE_FILES_CLIENT: |
Barotrauma.deps.json
Barotrauma.dll
Barotrauma.pdb
DedicatedServer.deps.json
DedicatedServer.dll
DedicatedServer.pdb
Publicized/Barotrauma.dll
Publicized/DedicatedServer.dll
ARCHIVE_FILES_SHARED: |
0Harmony.dll
Sigil.dll
MoonSharp.Interpreter.dll
MoonSharp.VsCodeDebugger.dll
MonoMod.Common.dll
Mono.Cecil.dll
Mono.Cecil.Mdb.dll
Mono.Cecil.Pdb.dll
Mono.Cecil.Rocks.dll
Microsoft.CodeAnalysis.CSharp.Scripting.dll
Microsoft.CodeAnalysis.CSharp.dll
Microsoft.CodeAnalysis.dll
Microsoft.CodeAnalysis.Scripting.dll
System.Collections.Immutable.dll
System.Reflection.Metadata.dll
System.Runtime.CompilerServices.Unsafe.dll
mscordaccore_amd64_amd64_*
Lua
jobs:
build:
uses: ./.github/workflows/build.yml
with:
ref: ${{ github.event.ref }}
publish-release:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download build artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: build
path: ${{ env.CI_DIR }}
- name: Extract build artifacts
run: |
artifacts_dir="$(realpath -m "$CI_DIR/artifacts")"
mkdir -p "$artifacts_dir"
tar -xzf "$CI_DIR/build.tar.gz" -C "$artifacts_dir"
rm "$CI_DIR/build.tar.gz"
- name: Create archives
run: |
set -e
shopt -s globstar nullglob
shopt -u dotglob
# This converts a newline-separated (LF) list into a Bash array
# NOTE: this doesn't discard the trailing LF that GitHub actions
# append (which results in an extra entry in the array).
lines_to_array() {
IFS=$'\n' readarray -td $'\n' "$1" <<< "${!1}"
}
lines_to_array ARCHIVE_FILES_SHARED
lines_to_array ARCHIVE_FILES_CLIENT
lines_to_array ARCHIVE_FILES_SERVER
lines_to_array RELEASES
artifacts_dir="$(realpath -m "$CI_DIR/artifacts")"
mkdir -p "$artifacts_dir"
archives_dir="$(realpath -m "$CI_DIR/archives")"
mkdir -p "$archives_dir"
for i in "${!RELEASES[@]}"; do
[[ -z "${RELEASES[i]}" ]] && continue
(
IFS=':' read platform side publish_dir _rest <<< "${RELEASES[i]}"
cd "${artifacts_dir}/${publish_dir}"
echo "Creating build_${platform}_${side}.zip"
zip --must-match -qr "${archives_dir}/${ARCHIVE_BASE_NAME}_build_${platform}_${side}.zip" *
echo "Creating build_${platform}_${side}.tar.gz"
tar -czf "${archives_dir}/${ARCHIVE_BASE_NAME}_build_${platform}_${side}.tar.gz" \
--owner=0 --group=0 \
*
if [[ "$side" == "client" ]]; then
files=(
${ARCHIVE_FILES_SHARED[@]}
${ARCHIVE_FILES_CLIENT[@]}
)
elif [[ "$side" == "server" ]]; then
files=(
${ARCHIVE_FILES_SHARED[@]}
${ARCHIVE_FILES_SERVER[@]}
)
else
echo "Invalid side: $side"
exit 1
fi
echo "Creating patch_${platform}_${side}.zip"
zip \
--must-match \
-qr \
"${archives_dir}/${ARCHIVE_BASE_NAME}_patch_${platform}_${side}.zip" \
"${files[@]}"
echo "Creating patch_${platform}_${side}.tar.gz"
tar \
-zcf "${archives_dir}/${ARCHIVE_BASE_NAME}_patch_${platform}_${side}.tar.gz" \
--owner=0 --group=0 \
"${files[@]}"
)
done
- name: Publish release
uses: notpeelz/action-gh-create-release@35fc26709d3cf4b5ebde1981f8f9d32012e1ba55 # v4.0.0
with:
token: ${{ github.token }}
tag: latest
strategy: replace
title: "Automatic build"
body: "Automatic build"
files: |
${{ env.CI_DIR }}/archives/${{ env.ARCHIVE_BASE_NAME }}_{build,patch}_{windows,linux,mac}_{client,server}.zip
${{ env.CI_DIR }}/archives/${{ env.ARCHIVE_BASE_NAME }}_{build,patch}_linux_{client,server}.tar.gz