Skip to content

Commit a6fd4a3

Browse files
author
Aliaksandr Adziareika
committed
<TBBAS-2530> Add download framework action
1 parent 935e446 commit a6fd4a3

File tree

2 files changed

+61
-18
lines changed

2 files changed

+61
-18
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Download openDAQ framework package from S3
2+
description: "Download a package from S3 and install it depending on OS and architecture"
3+
inputs:
4+
s3_bucket:
5+
required: true
6+
description: "S3 bucket name"
7+
s3_path:
8+
required: true
9+
description: "Path to package in bucket (without OS/arch)"
10+
s3_artefact:
11+
required: true
12+
description: "Filename in the S3 bucket"
13+
download_dir:
14+
required: false
15+
default: "."
16+
aws_access_key_id:
17+
required: true
18+
description: "AWS Access Key ID"
19+
aws_secret_access_key:
20+
required: true
21+
description: "AWS Secret Access Key"
22+
aws_region:
23+
required: true
24+
description: "AWS Region"
25+
runs:
26+
using: composite
27+
steps:
28+
- name: Prepare AWS CLI for S3
29+
uses: aws-actions/configure-aws-credentials@v4
30+
with:
31+
aws-access-key-id: ${{ inputs.aws_access_key_id }}
32+
aws-secret-access-key: ${{ inputs.aws_secret_access_key }}
33+
aws-region: ${{ inputs.aws_region }}
34+
35+
- name: Determine shell if not provided
36+
id: choose-shell
37+
run: |
38+
if [[ "${RUNNER_OS}" == "Windows" ]]; then
39+
echo "shell=pwsh" >> $GITHUB_OUTPUT
40+
else
41+
echo "shell=bash" >> $GITHUB_OUTPUT
42+
fi
43+
44+
- name: Download package from S3
45+
shell: ${{ steps.choose-shell.outputs.shell }}
46+
run: |
47+
aws s3 cp "s3://${{ inputs.s3_bucket }}/${{ inputs.s3_path }}/${{ inputs.s3_artefact }}" "${{ inputs.download_dir }}"

.github/workflows/opendaq-download-framework-aws.yml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,28 @@ on:
66

77
env:
88
s3bucket: bb-blueberry-sdk-releases
9-
s3sdk_path: /releases/main/SDK
9+
s3sdk_path: releases/main/SDK
10+
s3artefact: opendaq-3.21.0-ubuntu22.04-x86_64_ffc93d2.deb
1011

1112
jobs:
1213
build:
1314
runs-on: ubuntu-latest
1415
steps:
16+
- name: Checkout repo
17+
uses: actions/checkout@v4
1518

16-
- name: Configuring
17-
uses: aws-actions/configure-aws-credentials@v4
19+
- name: Download openDAQ framework
20+
uses: ./.github/actions/framework-download-s3
1821
with:
19-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
20-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
21-
aws-region: ${{ secrets.AWS_REGION }}
22-
23-
- name: Enumerate artifacts
24-
run: |
25-
echo "Available artifacts:"
26-
aws s3 ls "s3://${{ env.s3bucket }}${{env.s3sdk_path}}" --human-readable
22+
s3_bucket: ${{ env.s3bucket }}
23+
s3_path: ${{ env.s3sdk_path }}
24+
s3_artefact: ${{ env.s3artefact }}
25+
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
26+
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
27+
aws_region: ${{ secrets.AWS_REGION }}
2728

28-
- name: Download artifact
29-
run: |
30-
echo "Downloading to $(pwd)"
31-
aws s3 cp "s3://${{ env.s3bucket }}${{env.s3sdk_path}}/opendaq-3.21.0-ubuntu22.04-x86_64_ffc93d2.deb" .
32-
3329
- name: Uploadading artifact
3430
uses: actions/upload-artifact@v4
3531
with:
36-
name: opendaq-3.21.0-ubuntu22.04-x86_64_ffc93d2.deb
37-
path: ./opendaq-3.21.0-ubuntu22.04-x86_64_ffc93d2.deb
32+
name: ${{ env.s3artefact }}
33+
path: ./${{ env.s3artefact }}

0 commit comments

Comments
 (0)