Skip to content

Commit c25a073

Browse files
committed
Create github action
Signed-off-by: Andy Doan <andy@foundries.io>
1 parent 0acd052 commit c25a073

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

action.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Upload Private Artifacts"
2+
description: "Uploads build artifacts that should not be available for public consumption."
3+
inputs:
4+
path:
5+
description: "Directory containing the files to upload"
6+
required: true
7+
build_id:
8+
description: "Path on fileserver to put artifacts under: ${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}"
9+
required: true
10+
fileserver_url:
11+
description: "Server to use for upload"
12+
required: true
13+
default: "https://quic-yocto-fileserver-1029608027416.us-central1.run.app'"
14+
upload_threads:
15+
description: "Number of concurrent upload threads to use"
16+
required: true
17+
default: "5"
18+
outputs:
19+
url:
20+
description: "URL where objects are availble at"
21+
value: ${{ steps.upload.outputs.url }}
22+
runs:
23+
using: "composite"
24+
steps:
25+
- name: Upload Artifacts
26+
id: upload
27+
env:
28+
BUILD_DIR: ${{ inputs.path }}
29+
BUILD_ID: ${{ inputs.build_id}}
30+
FILE_SERVER: ${{ inputs.fileserver_url }}
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
UPLOAD_THREADS: ${{ inputs.upload_threads }}
33+
shell: bash
34+
run: ./publish_artifacts.py

publish_artifacts.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def get_files_to_publish(path: str) -> List[str]:
7878
return paths
7979

8080

81-
def main(num_threads: int, artifacts_dir: str, base_url: str):
81+
def main(num_threads: int, artifacts_dir: str, base_url: str, output_file: str):
8282
paths = get_files_to_publish(artifacts_dir)
8383
print(f"= Found {len(paths)} files to publish", flush=True)
8484

@@ -96,6 +96,9 @@ def main(num_threads: int, artifacts_dir: str, base_url: str):
9696
if failed:
9797
sys.exit(1)
9898

99+
with open(output_file, "a") as f:
100+
f.write(f"build_url={base_url}")
101+
99102

100103
if __name__ == "__main__":
101104
build_dir = os.environ["BUILD_DIR"]
@@ -112,4 +115,6 @@ def main(num_threads: int, artifacts_dir: str, base_url: str):
112115
num_threads_str = os.environ.get("UPLOAD_THREADS", "5")
113116
num_threads = int(num_threads_str)
114117

115-
main(num_threads, build_dir, url)
118+
output_file = os.environ["GITHUB_OUTPUT"]
119+
120+
main(num_threads, build_dir, url, output_file)

0 commit comments

Comments
 (0)