Skip to content

Commit

Permalink
workflow: Carbonix_build to push data to AWS S3 bucket
Browse files Browse the repository at this point in the history
This mods will push the data in 3 category

Folder name is modified with pre fix of UTC dat, time, branch name, commit ID  and PR id 

Folder Directory:
Release: carbonix-firmware-release-files/Carbopilot_V2
Merge to CxPilot : carbonix-firmware-dev-files/Carbopilot_V2/CxPilot*/
Others: carbonix-firmware-dev-files/Carbopilot_V2/PR

SW-199
  • Loading branch information
loki077 committed May 27, 2024
1 parent 3f83f31 commit 531ec1a
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/carbonix_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ on:
- '.vscode/**'
- '.github/ISSUE_TEMPLATE/**'

release:
types: [published]

workflow_dispatch:

concurrency:
Expand Down Expand Up @@ -219,3 +222,39 @@ jobs:
name: ${{ env.firmware_version }}_${{ env.commit_id }}
path: temp
retention-days: 90

- name: Install AWS CLI
run: |
sudo apt-get update
sudo apt-get install -y curl unzip
curl "https://d1vvhvl2y92vvt.cloudfront.net/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Set BRANCH_NAME
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV

- name: Upload artifacts to S3
run: |
DATE_HR=$(date +%Y%m%d_%H%M)
if ${{ github.event_name == 'release' }}; then
PATH_TO_S3=s3://carbonix-firmware-release-files/Carbopilot_V2/${DATE_HR}_${{ env.firmware_version }}_${{ env.commit_id }}/
echo "Uploading to: $PATH_TO_S3"
aws s3 cp temp/ $PATH_TO_S3 --recursive
elif ${{ github.event_name == 'push' && startsWith(env.BRANCH_NAME, 'CxPilot') }}; then
PATH_TO_S3=s3://carbonix-firmware-dev-files/Carbopilot_V2/${{ env.BRANCH_NAME }}/${DATE_HR}_${{ env.firmware_version }}_${{ env.commit_id }}/
echo "Uploading to: $PATH_TO_S3"
aws s3 cp temp/ $PATH_TO_S3 --recursive
elif ${{ github.event_name == 'pull_request' }}; then
PATH_TO_S3=s3://carbonix-firmware-dev-files/Carbopilot_V2/PR/${DATE_HR}_${{ env.firmware_version }}_${{ env.commit_id }}_${{ github.event.pull_request.number }}/
echo "Uploading to: $PATH_TO_S3"
aws s3 cp temp/ $PATH_TO_S3 --recursive
fi

0 comments on commit 531ec1a

Please sign in to comment.