Skip to content

main-release

main-release #13

Workflow file for this run

on:
workflow_run:
workflows: ["tests"]
branches: [ main ]
types:
- completed
workflow_dispatch:
name: main-release
jobs:
release:
name: Release
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Bump version and push tag
id: version
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: false
RELEASE_BRANCHES: main
DEFAULT_BUMP: patch
TAG_CONTEXT: branch
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Build, tag, and push the image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: public.ecr.aws/strongdm
ECR_REPOSITORY: log-export-container
IMAGE_TAG: ${{ steps.version.outputs.new_tag }}
run: |
# Adding version
echo _version_=\"$IMAGE_TAG\" > fluentd/_version.rb
# Building docker image
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
# Pushing image to ECR
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"