Skip to content

Merge pull request #74 from axiomhq/islam/axiom-4385-rework-the-stacks #16

Merge pull request #74 from axiomhq/islam/axiom-4385-rework-the-stacks

Merge pull request #74 from axiomhq/islam/axiom-4385-rework-the-stacks #16

Workflow file for this run

name: Release
permissions:
id-token: write
contents: read
on:
push:
tags:
- "v*"
env:
YQ_VERSION: "4.25.1"
jobs:
release:
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v3
- run: wget https://github.com/mikefarah/yq/releases/download/v$YQ_VERSION/yq_linux_amd64.tar.gz -O - | tar xz && mv yq_linux_amd64 /usr/local/bin/yq
- run: |-
mkdir build
yq ".Resources.AxiomCloudWatchForwarder.Properties.Code.ZipFile = \"$(sed 's/\"/\\\"/g' ./forwarder.py)\"" cloudformation-stacks/forwarder.template.yaml > build/axiom-cloudwatch-forwarder-v${{ github.ref_name }}-cloudformation-stack.yaml
yq ".Resources.SubscriberLambda.Properties.Code.ZipFile = \"$(sed 's/\"/\\\"/g' ./subscriber.py)\"" cloudformation-stacks/subscriber.template.yaml > build/axiom-cloudwatch-subscriber-v${{ github.ref_name }}-cloudformation-stack.yaml
yq ".Resources.UnsubscriberLambda.Properties.Code.ZipFile = \"$(sed 's/\"/\\\"/g' ./unsubscriber.py)\"" cloudformation-stacks/unsubscriber.template.yaml > build/axiom-cloudwatch-unsubscriber-v${{ github.ref_name }}-cloudformation-stack.yaml
yq ".Resources.ListenerLambda.Properties.Code.ZipFile = \"$(sed 's/\"/\\\"/g' ./listener.py)\"" cloudformation-stacks/listener.template.yaml > build/axiom-cloudwatch-listener-v${{ github.ref_name }}-cloudformation-stack.yaml
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: ${{ vars.AWS_IAM_ROLE }}
role-session-name: release_to_prod
- name: Release to Production
env:
SOURCE_DIR: build
AWS_S3_BUCKET: "axiom-cloudformation"
DEST_DIR: "stacks"
run: aws s3 sync --acl public-read ./$SOURCE_DIR s3://$AWS_S3_BUCKET/$DEST_DIR