feat: enhance auto-release workflow to steam workshop

This commit is contained in:
Linventif 2025-07-05 16:18:21 +00:00
parent 92fc9ca707
commit d2cfe9f17c
3 changed files with 106 additions and 1 deletions

View File

@ -144,9 +144,12 @@ jobs:
run: |
mkdir -p gmod-integration-release/addons/gmod-integration
cp -r lua/ gmod-integration-release/addons/gmod-integration/
[ -f README.md ] && cp README.md gmod-integration-release/addons/gmod-integration/
[ -f LICENSE ] && cp LICENSE gmod-integration-release/addons/gmod-integration/
# Copy README.md to both addon folder and root of zip
[ -f README.md ] && cp README.md gmod-integration-release/addons/gmod-integration/
[ -f README.md ] && cp README.md gmod-integration-release/
cat > gmod-integration-release/addons/gmod-integration/addon.json << EOF
{
"title": "Gmod Integration",
@ -224,3 +227,39 @@ jobs:
env:
GMODSTORE_API_TOKEN: ${{ secrets.GMODSTORE_API_TOKEN }}
GMODSTORE_PRODUCT_ID: ${{ secrets.GMODSTORE_PRODUCT_ID }}
publish_workshop:
name: Publish to Steam Workshop
runs-on: ubuntu-latest
needs: [build, version]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build gmod-uploader Docker image
run: docker build -t gmod-uploader .
- name: Publish to Steam Workshop
env:
STEAM_USER: ${{ secrets.STEAM_USER }}
STEAM_PASS: ${{ secrets.STEAM_PASS }}
PUBLISHED_FILE_ID: ${{ secrets.GMOD_INTEGRATION_PUBLISHED_FILE_ID }}
NEW_VERSION: ${{ needs.version.outputs.new_version }}
NEW_TAG: ${{ needs.version.outputs.new_tag }}
CONTENT_PATH: /data
TITLE: 'Gmod Integration v${{ needs.version.outputs.new_version }}'
DESCRIPTION: |
Update **v${{ needs.version.outputs.new_version }}**
See full details and changelog on GitHub → https://github.com/${{ github.repository }}/releases/tag/${{ needs.version.outputs.new_tag }}
VISIBILITY: '0' # 0=public,1=friends,2=private
run: |
docker run --rm \
-e STEAM_USER \
-e STEAM_PASS \
-e CONTENT_PATH \
-e TITLE \
-e DESCRIPTION \
-e VISIBILITY \
-e PUBLISHED_FILE_ID \
-v ${{ github.workspace }}:/data \
gmod-uploader

33
Dockerfile Normal file
View File

@ -0,0 +1,33 @@
# Dockerfile
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# 1) Install 32-bit libs & utilities
RUN dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
wget \
unzip \
lib32gcc-s1 \
lib32stdc++6 \
dos2unix \
&& rm -rf /var/lib/apt/lists/*
# 2) Manually install SteamCMD into /steamcmd
RUN mkdir -p /steamcmd \
&& cd /steamcmd \
&& wget -qO- https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz \
| tar zxvf - \
&& chmod +x steamcmd.sh
# 3) Set working dir and copy your entrypoint
WORKDIR /app
COPY entrypoint.sh .
# 4) Convert line endings & make executable
RUN dos2unix entrypoint.sh \
&& chmod +x entrypoint.sh
# 5) Invoke via bash so we dont get exec-format errors
ENTRYPOINT ["bash", "/app/entrypoint.sh"]

33
entrypoint.sh Normal file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -e
: "${STEAM_USER:?Please set STEAM_USER}"
: "${STEAM_PASS:?Please set STEAM_PASS}"
: "${CONTENT_PATH:?Please set CONTENT_PATH (e.g. /data/adn-test)}"
: "${TITLE:?Please set TITLE}"
: "${DESCRIPTION:?Please set DESCRIPTION}"
# Optional Steam Guard:
STEAM_GUARD_ARG=""
[ -n "$STEAM_GUARD" ] && STEAM_GUARD_ARG="$STEAM_GUARD"
# Generate the VDF pointing at your folder
cat > /app/workshop_item.vdf <<EOF
"workshopitem"
{
"appid" "4000"
"publishedfileid" "${PUBLISHED_FILE_ID:-0}"
"contentfolder" "${CONTENT_PATH}"
"previewfile" "${PREVIEW_FILE:-}"
"visibility" "${VISIBILITY:-0}"
"title" "${TITLE}"
"description" "${DESCRIPTION}"
}
EOF
echo "[`date '+%F %T'`] Publishing to Workshop…"
/steamcmd/steamcmd.sh +login "${STEAM_USER}" "${STEAM_PASS}" "${STEAM_GUARD_ARG}" \
+workshop_build_item /app/workshop_item.vdf \
+quit
echo "[`date '+%F %T'`] Done."