Skip to content

0.0.3

0.0.3 #10

Workflow file for this run

name: Upload new release
on:
release:
types: [published]
jobs:
build_function:
name: Build function
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- run: git fetch --force --tags
- uses: actions/setup-go@v4
with:
go-version: '1.19'
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --clean
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
upload_to_buckets:
name: Upload to S3 buckets
runs-on: ubuntu-latest
needs: build_function
strategy:
matrix:
aws_region:
- 'us-east-1'
- 'us-east-2'
- 'us-west-1'
- 'us-west-2'
- 'eu-central-1'
- 'eu-north-1'
- 'eu-west-1'
- 'eu-west-2'
- 'eu-west-3'
- 'sa-east-1'
- 'ap-northeast-1'
- 'ap-northeast-2'
- 'ap-northeast-3'
- 'ap-south-1'
- 'ap-southeast-1'
- 'ap-southeast-2'
- 'ca-central-1'
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Download release for security hub collector
run: wget -c https://github.com/logzio/aws-security-hub/releases/download/${{ github.event.release.tag_name }}/aws-security-hub_${{ github.event.release.tag_name }}_linux_amd64.zip -O function.zip
- name: create new version
run: |
cp ./collector/sam/template.yaml ./template-${{ matrix.aws_region }}.yaml
sed -i "s/<<VERSION>>/${{ github.event.release.tag_name }}/" "./template-${{ matrix.aws_region }}.yaml"
sed -i "s/<<REGION>>/${{ matrix.aws_region }}/" "./template-${{ matrix.aws_region }}.yaml"
shell: bash
- name: Upload to aws
run: |
sudo apt-get update
sudo apt-get install awscli
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY }}
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_KEY }}
aws configure set region ${{ matrix.aws_region }}
aws s3 cp ./template-${{ matrix.aws_region }}.yaml s3://logzio-aws-integrations-${{ matrix.aws_region }}/aws-security-hub-collector/${{ github.event.release.tag_name }}/template.yaml --acl public-read
aws s3 cp ./function.zip s3://logzio-aws-integrations-${{ matrix.aws_region }}/aws-security-hub-collector/${{ github.event.release.tag_name }}/function.zip --acl public-read
shell: bash
- name: Clean
run: |
rm ./template-${{ matrix.aws_region }}.yaml
rm ./function.zip