From d2cfe9f17cbab4855dcaaab1ab65dfcb89d1802d Mon Sep 17 00:00:00 2001 From: Linventif Date: Sat, 5 Jul 2025 16:18:21 +0000 Subject: [PATCH] feat: enhance auto-release workflow to steam workshop --- .github/workflows/auto-release.yml | 41 +++++++++++++++++++++++++++++- Dockerfile | 33 ++++++++++++++++++++++++ entrypoint.sh | 33 ++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 entrypoint.sh diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index 69eb2d2..7a65f98 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..96a6e23 --- /dev/null +++ b/Dockerfile @@ -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 don’t get exec-format errors +ENTRYPOINT ["bash", "/app/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..58d14b4 --- /dev/null +++ b/entrypoint.sh @@ -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 <