Skip to content

Commit

Permalink
Fix path and allow running outside GH actions (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesserockz authored Mar 24, 2022
1 parent 9b29196 commit 2365fc4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions entrypoint.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/python3

import os
import subprocess
import sys
import json
Expand Down Expand Up @@ -70,10 +71,13 @@

print("::group::Copy firmware file(s) to folder")
file_base.mkdir(parents=True, exist_ok=True)
shutil.chown(file_base, GH_RUNNER_USER_UID, GH_RUNNER_USER_GID)

if os.environ.get("GITHUB_JOB") is not None:
shutil.chown(file_base, GH_RUNNER_USER_UID, GH_RUNNER_USER_GID)

shutil.copyfile(bin, file_base / f"{name}.bin")
shutil.chown(file_base / "firmware.bin", GH_RUNNER_USER_UID, GH_RUNNER_USER_GID)
if os.environ.get("GITHUB_JOB") is not None:
shutil.chown(file_base / f"{name}.bin", GH_RUNNER_USER_UID, GH_RUNNER_USER_GID)

chip_family = None
define: str
Expand Down Expand Up @@ -104,6 +108,7 @@
with open(file_base / "manifest.json", "w") as f:
json.dump(manifest, f, indent=2)

shutil.chown(file_base / "manifest.json", GH_RUNNER_USER_UID, GH_RUNNER_USER_GID)
if os.environ.get("GITHUB_JOB") is not None:
shutil.chown(file_base / "manifest.json", GH_RUNNER_USER_UID, GH_RUNNER_USER_GID)

print("::endgroup::")

0 comments on commit 2365fc4

Please sign in to comment.