Skip to content

Commit

Permalink
WIP Workshop update checker
Browse files Browse the repository at this point in the history
This (should) add a static file to the Workshop version only that contains the current commit hash before the upload process, which is then used to check for updates like normal. Haven't been able to test this from start to finish yet, but we'll see how it goes once everything is ready for release.
  • Loading branch information
thecraftianman committed Jan 22, 2024
1 parent a8a7fa3 commit 62b809c
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/workshop-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy to Workshop

on:
push:
branches:
- master
workflow_dispatch:

jobs:
deploy:
if: github.repository == 'ACF-Team/ACF-3'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Create Commit Version File
shell: bash
run: |
mkdir data_static
mkdir data_static/acf
cat > data_static/acf/acf-3-version.txt
${{ github.sha }}
EOF

- name: Upload to Workshop
uses: CFC-Servers/gmod-upload@master
with:
id: whatever the ID ends up being
changelog: "${{ github.event.head_commit.message }}"
title: "[ACF-3] Armored Combat Framework"
type: "tool"
tag1: "build"
tag2: "fun"
tag3: "realism"
env:
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}
8 changes: 8 additions & 0 deletions lua/acf/core/version/version_sh.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ do -- Local repository version checking
if not Data then return end

local Path = Data.Path
local WorkshopPath = "data_static/acf/" .. string.lower(Name) .. "-version.txt"

if not Path then
Data.Code = "Not Installed"
Expand All @@ -77,6 +78,13 @@ do -- Local repository version checking

Data.Code = "Git-" .. Code
Data.Date = LocalToUTC(Date)
elseif file.Exists(WorkshopPath, "GAME") then
local FileData = file.Read(WorkshopPath, "GAME"):Trim()
local Code = string.sub(FileData, 1, 7)
local Date = file.Time(WorkshopPath, "GAME")

Data.Code = "Workshop-" .. Code
Data.Date = LocalToUTC(Date)
elseif file.Exists(Path .. "/LICENSE", "GAME") then
local Date = file.Time(Path .. "/LICENSE", "GAME")

Expand Down

0 comments on commit 62b809c

Please sign in to comment.