mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-14 17:16:41 +02:00
Swap SLSA releaser to use GH steps to pass through files, rather than downloading via HTTP
This commit is contained in:
parent
4673b99579
commit
da99e46e42
6
.github/workflows/slsa-releaser.yml
vendored
6
.github/workflows/slsa-releaser.yml
vendored
@ -120,6 +120,12 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
|
- uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741
|
||||||
|
with:
|
||||||
|
name: hishtory-darwin-arm64
|
||||||
|
- uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741
|
||||||
|
with:
|
||||||
|
name: hishtory-darwin-amd64
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Download and sign the latest executables
|
- name: Download and sign the latest executables
|
||||||
env:
|
env:
|
||||||
|
@ -4,11 +4,6 @@ import time
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
version = os.environ['GITHUB_REF'].split('/')[-1].split("-")[0]
|
|
||||||
print("Downloading binaries (this may pause for a while)")
|
|
||||||
waitUntilPublished(f"https://github.com/ddworken/hishtory/releases/download/{version}/hishtory-darwin-arm64", "hishtory-darwin-arm64")
|
|
||||||
waitUntilPublished(f"https://github.com/ddworken/hishtory/releases/download/{version}/hishtory-darwin-amd64", "hishtory-darwin-amd64")
|
|
||||||
|
|
||||||
print("before sha1sum:")
|
print("before sha1sum:")
|
||||||
os.system("sha1sum hishtory-* 2>&1")
|
os.system("sha1sum hishtory-* 2>&1")
|
||||||
|
|
||||||
@ -42,17 +37,5 @@ def notAscii(fn):
|
|||||||
if "ASCII text" in out:
|
if "ASCII text" in out:
|
||||||
raise Exception(f"fn={fn} is of type {out}")
|
raise Exception(f"fn={fn} is of type {out}")
|
||||||
|
|
||||||
def waitUntilPublished(url, output) -> None:
|
|
||||||
startTime = time.time()
|
|
||||||
while True:
|
|
||||||
r = requests.get(url, headers={'authorization': f'bearer {os.environ["GITHUB_TOKEN"]}'})
|
|
||||||
if r.status_code == 200:
|
|
||||||
break
|
|
||||||
if (time.time() - startTime)/60 > 20:
|
|
||||||
raise Exception(f"failed to get url={url} (startTime={startTime}, endTime={time.time()}), status_code=" + str(r.status_code) + " body=" + str(r.content))
|
|
||||||
time.sleep(5)
|
|
||||||
with open(output, 'wb') as f:
|
|
||||||
f.write(r.content)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
Loading…
x
Reference in New Issue
Block a user