Skip to content

Commit 7f20f40

Browse files
authored
ci: Add upload verified artifacts to S3 action (runfinch#1437)
Signed-off-by: Cartrius Phipps <[email protected]>
1 parent 811b0b7 commit 7f20f40

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Upload Verified Artifacts to S3
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'deps/finch-core'
9+
10+
permissions:
11+
id-token: write
12+
contents: read
13+
14+
jobs:
15+
upload-artifacts:
16+
name: Upload Artifacts to S3
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21+
with:
22+
submodules: recursive
23+
24+
- name: Configure AWS credentials
25+
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
26+
with:
27+
aws-region: ${{ secrets.REGION }}
28+
role-to-assume: ${{ secrets.ROLE }}
29+
role-session-name: update-latest-os-artifacts-in-s3
30+
31+
- name: Update latest base OS artifact information in S3
32+
run: |
33+
# Update the latest verified base OS artifact information in S3
34+
echo "Uploading the verified base OS artifact information to S3"
35+
36+
# Extract updated artifact information
37+
source deps/finch-core/deps/full-os.conf
38+
39+
# Create manifest file to hold artifact information
40+
MANIFEST_FILE="latest-os-artifacts.json"
41+
echo '{
42+
"aarch64": {
43+
"filename": "'$AARCH64_ARTIFACT'",
44+
"sha512sum": "'$AARCH64_512_DIGEST'"
45+
},
46+
"x86_64": {
47+
"filename": "'$X86_64_ARTIFACT'",
48+
"sha512sum": "'$X86_64_512_DIGEST'"
49+
}
50+
}' > $MANIFEST_FILE
51+
52+
# Upload to S3
53+
aws s3 cp $MANIFEST_FILE s3://${{ secrets.ARTFACT_BUCKET_NAME }}/manifest/latest-os-artifacts.json --content-type "application/json"
54+
55+
- name: Update latest rootfs information in S3
56+
run: |
57+
# Update the latest verified rootfs information in S3
58+
echo "Uploading the latest verified rootfs information in S3"
59+
# Extract updated artifact information
60+
source deps/finch-core/deps/rootfs.conf
61+
62+
# Create manifest file to hold artifact information
63+
MANIFEST_FILE="latest-rootfs-artifacts.json"
64+
echo '{
65+
"filename": "'$X86_64_ARTIFACT'",
66+
"sha512sum": "'$X86_64_512_DIGEST'"
67+
}' > $MANIFEST_FILE
68+
69+
# Upload to S3
70+
aws s3 cp $MANIFEST_FILE s3://${{ secrets.ARTIFACT_BUCKET_NAME }}/manifest/latest-rootfs-artifacts.json --content-type "application/json"

0 commit comments

Comments
 (0)