Skip to content

Commit

Permalink
Update GHA build workflow to always upload package to the S3 bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
QU3B1M committed Oct 30, 2024
1 parent 9937112 commit 5a88497
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ on:
description: "Revision"
type: string
default: "0"
upload:
description: "Upload ?"
type: boolean
default: false
is_stage:
description: "Is stage ?"
type: boolean
Expand Down Expand Up @@ -302,33 +298,19 @@ jobs:
if-no-files-found: error

- name: Set up AWS CLI
if: ${{ inputs.upload }}
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.CI_INTERNAL_DEVELOPMENT_BUCKET_USER_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.CI_INTERNAL_DEVELOPMENT_BUCKET_USER_SECRET_KEY }}
aws-region: ${{ secrets.CI_AWS_REGION }}

- name: Check if package exists on S3
if: ${{ inputs.upload }}
run: |
dest="s3://packages-dev.internal.wazuh.com/development/wazuh/5.x/main/packages/"
s3uri="${dest}${{ steps.package.outputs.name }}"
if aws s3 ls "$s3uri" > /dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
id: package_in_s3

- name: Upload package to S3
if: ${{ inputs.upload && steps.package_in_s3.outputs.exists == 'false' }}
run: |
src="artifacts/dist/${{ steps.package.outputs.name }}"
dest="s3://packages-dev.internal.wazuh.com/development/wazuh/5.x/main/packages/"
aws s3 cp "$src" "$dest"
s3uri="${dest}${{ steps.package.outputs.name }}"
echo "::notice::"S3 URI: ${s3uri}"
echo "::notice::S3 URI: ${s3uri}"
- name: Upload checksum to S3
if: ${{ inputs.upload && inputs.checksum }}
Expand All @@ -337,4 +319,4 @@ jobs:
dest="s3://packages-dev.internal.wazuh.com/development/wazuh/5.x/main/packages/"
aws s3 cp "$src" "$dest"
s3uri="${dest}${{ steps.package.outputs.name }}.sha512"
echo ""::notice::S3 sha512 URI: ${s3uri}"
echo "::notice::S3 sha512 URI: ${s3uri}"

0 comments on commit 5a88497

Please sign in to comment.