Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload packages to S3 #179

Merged
merged 12 commits into from
Mar 8, 2024
19 changes: 18 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ on:
workflow_dispatch:
inputs:
revision:
description: "Any string or number used to extend the package's identifier"
description: "Revision"
type: string
required: true
default: "1"
upload:
description: "Upload ?"
type: bool
default: false

# ==========================
# Bibliography
Expand Down Expand Up @@ -64,3 +68,16 @@ jobs:
architecture: ${{ matrix.architecture }}
distribution: ${{ matrix.distribution }}
min: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }}

upload:
needs: [version, commit_sha, assemble]
# Upload only on 'workflow_dispatch' event and if 'upload=true'
if: ${{ github.event_name == 'push' && inputs.upload }}
strategy:
fail-fast: false
matrix:
os: [{ suffix: "amd64", ext: "deb" }, { suffix: "x86_64", ext: "rpm" }]
uses: ./.github/workflows/r_upload.yml
with:
package: wazuh-indexer-${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}_${{ matrix.os.suffix }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.os.ext }}
secrets: inherit
41 changes: 41 additions & 0 deletions .github/workflows/r_upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Upload (reusable)

# This workflow runs when any of the following occur:
# - Run from another workflow
on:
workflow_call:
inputs:
package:
description: "The name of the package to upload to Wazuh's S3 development artifactory bucket."
required: true
type: string
secrets:
CI_INTERNAL_DEVELOPMENT_BUCKET_USER_ACCESS_KEY:
required: true
CI_INTERNAL_DEVELOPMENT_BUCKET_USER_SECRET_KEY:
required: true

jobs:
r_upload:
runs-on: ubuntu-latest
# Permissions to upload the package
permissions:
packages: read
contents: read
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ inputs.package }}
path: artifacts/dist

- name: Set up AWS CLI
uses: aws-actions/configure-aws-credentials@v1
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: us-east-1

- name: Upload package to S3
run: |
aws s3 cp artifacts/dist/${{ inputs.package }} s3://packages-dev.internal.wazuh.com/development/wazuh/4.x/main/packages/
Loading