Skip to content

Commit 49d7d12

Browse files
authored
Create update-package-description.yml
1 parent 61fd517 commit 49d7d12

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Update EOS SDK Version in package.json
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
update-version:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v3
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: '3.x'
18+
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install pywin32
23+
24+
- name: Extract EOS SDK version from DLL
25+
id: extract_version
26+
run: |
27+
import win32api
28+
import sys
29+
import json
30+
31+
dll_path = 'Assets/Plugins/Windows/x64/EOSSDK-Win64-Shipping.dll'
32+
info = win32api.GetFileVersionInfo(dll_path, '\\')
33+
ms = info['FileVersionMS']
34+
ls = info['FileVersionLS']
35+
version = f"{(ms >> 16) & 0xffff}.{ms & 0xffff}.{(ls >> 16) & 0xffff}.{ls & 0xffff}"
36+
print(f"::set-output name=eos_version::{version}")
37+
38+
- name: Debug new package.json description
39+
run: |
40+
import json
41+
42+
package_json_path = 'com.playeveryware.eos/package.json'
43+
with open(package_json_path, 'r') as file:
44+
data = json.load(file)
45+
46+
eos_version = "${{ steps.extract_version.outputs.eos_version }}"
47+
description = data.get("description", "")
48+
49+
updated_description = '\n'.join([
50+
line if not line.startswith("EOS SDK ") else f"EOS SDK {eos_version}"
51+
for line in description.splitlines()
52+
])
53+
54+
print("Updated package.json description:")
55+
print(updated_description)

0 commit comments

Comments
 (0)