Skip to content

Commit

Permalink
Merge pull request #8 from 7Cav/update
Browse files Browse the repository at this point in the history
Use arma 3 tools instead of armake
  • Loading branch information
AndreasBrostrom authored Dec 23, 2024
2 parents 1cbd9e7 + 69ad817 commit 5b3fc54
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,26 @@ jobs:
uses: arma-actions/hemtt@v1
- name: Setup steamcmd
uses: CyberAndrii/setup-steamcmd@v1
- name: Install Arma 3 Tools
uses: arma-actions/arma3-tools@master
with:
toolsUrl: ${{ secrets.ARMA3_TOOLS_URL }}

- name: Get short commit hash
run: |
git rev-parse --short=8 HEAD
echo "SHORT_SHA=$(git rev-parse --short=8 HEAD)" >> $GITHUB_ENV
- name: Assemble
env:
SHA_SHORT: ${{ env.SHORT_SHA }}
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}
run: |
$env:Path += ";$PWD\scripts"
$env:Path += ";$PWD\scripts;\C:\Arma3Tools\DSSignFile"
echo "Building ${{ github.ref_name }} $env:SHA_SHORT"
python scripts\assemble.py --username $env:STEAM_USERNAME --password $env:STEAM_PASSWORD -s $env:SHA_SHORT
- name: Upload release
uses: svenstaro/upload-release-action@v2
with:
Expand Down
Binary file removed scripts/armake.exe
Binary file not shown.
29 changes: 24 additions & 5 deletions scripts/assemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@

STEAMCMD = os.path.join("steamcmd")
HEMTT = os.path.join("hemtt")
ARMAKE = os.path.join("armake")

KEYCREATE = os.path.join("DSCreateKey")
KEYSIGN = os.path.join("DSSignFile")
KEYCHECK = os.path.join("DSCheckSignatures")

WORKDIR = os.path.join(PROJECTROOT,".cavauxout")
WORKSHOPOUT = os.path.join(WORKDIR,"steamapps","workshop","content","107410")
Expand All @@ -24,7 +27,7 @@
def check_required_tools():
toolsMissing = False
print("Checking tools:")
for tool in [STEAMCMD, HEMTT, ARMAKE]:
for tool in [STEAMCMD, HEMTT, KEYCREATE, KEYSIGN, KEYCHECK]:
if shutil.which(tool):
print(' > {}{}'.format(f"{tool}: ".ljust(12), shutil.which(tool)))
else:
Expand Down Expand Up @@ -298,10 +301,12 @@ def main():
privateKeyName = f"cavaux_{version}-{commit}"
privateKeyFullName = f"{privateKeyName}.biprivatekey"
print(f"Making '{privateKeyName}'...") if args.verbose else ""

subprocess.run(
[ARMAKE, 'keygen', '-f', privateKeyName],
[KEYCREATE, privateKeyName],
shell=True, check=False
)

keys = glob.glob(os.path.join(releaseKeysFolder,'*'))

# Check if successful
Expand All @@ -317,15 +322,29 @@ def main():
for pbo in glob.glob(os.path.join(releaseAddonFolder,'*.pbo')):
print(f"Signing {pbo}") if args.verbose else ""
subprocess.run(
[ARMAKE, 'sign', '-f', os.path.join(releaseKeysFolder,privateKeyFullName),pbo],
shell=True
[KEYSIGN, os.path.join(releaseKeysFolder,privateKeyFullName), pbo],
shell=True, check=False
)

createdKey = glob.glob(os.path.join(releaseKeysFolder,f'{pbo}*.bisign'))
if not len(createdKey) == 1:
print(f"[Error] failed to sign {pbo}")
sys.exit(1)
print(f"Signing completed {createdKey[0]}") if args.verbose else ""


# Check signing
print(f"Checking project signature...")
proc = subprocess.run(
[KEYCHECK, "-deep", releaseAddonFolder, releaseKeysFolder],
shell=True, check=False, capture_output=True, text=True
)
print(proc.stdout, end="")
if proc.returncode >= 1:
print(f"[Error] failed to sign pbos")
sys.exit(1)
print(f"Signing successful") if args.verbose else ""

os.remove(os.path.join(releaseKeysFolder,privateKeyFullName))
os.chdir(PROJECTROOT)

Expand Down

0 comments on commit 5b3fc54

Please sign in to comment.