Skip to content

Release

Release #193

Workflow file for this run

name: Release
on:
schedule:
# schedule for 0242 every sunday
- cron: '42 2 * * 0'
push:
branches:
- master
jobs:
deploy:
name: Build and deploy container image
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Login to AWS ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build and tag docker image
env:
DOCKER_BUILDKIT: 1
run: |
image_tag="$(date +%Y%m%d%H%M%S)-$(echo ${{ github.sha }} | cut -c1-6)"
echo "IMAGE_TAG=$image_tag" >> $GITHUB_ENV
docker build -t moarcats:$image_tag .
- name: Tag for release
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: moarcats
run: |
docker tag moarcats:${{ env.IMAGE_TAG }} $ECR_REGISTRY/$ECR_REPOSITORY:${{ env.IMAGE_TAG }}
docker push $ECR_REGISTRY/$ECR_REPOSITORY:${{ env.IMAGE_TAG }}
- name: Tag latest docker image if on master
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: moarcats
run: |
docker tag moarcats:${{ env.IMAGE_TAG }} \
$ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
- name: Logout of registries
if: always()
run: |
docker logout ${{ steps.login-ecr.outputs.registry }}