Skip to content

Commit

Permalink
Add GHA step block to validate if the package already exists in s3 be…
Browse files Browse the repository at this point in the history
…fore pushing it
  • Loading branch information
QU3B1M committed Oct 30, 2024
1 parent 704b580 commit d4d49d2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,20 @@ jobs:
aws-secret-access-key: ${{ secrets.CI_INTERNAL_DEVELOPMENT_BUCKET_USER_SECRET_KEY }}
aws-region: ${{ secrets.CI_AWS_REGION }}

- name: Upload package to S3
- name: Check if package exists on S3
if: ${{ inputs.upload }}
run: |
src="artifacts/dist/${{ steps.package.outputs.name }}"
dest="s3://packages-dev.internal.wazuh.com/development/wazuh/5.x/main/packages/"
if aws s3api head-object --bucket <some_bucket> --key <some_key>; 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.exists_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/"
Expand Down

0 comments on commit d4d49d2

Please sign in to comment.