Skip to content

Merge pull request #962 from TempleDAO/fostrich-tlc-fix #8

Merge pull request #962 from TempleDAO/fostrich-tlc-fix

Merge pull request #962 from TempleDAO/fostrich-tlc-fix #8

name: Build/push image for temple tasks
on:
push:
tags:
- temple-tasks-*
jobs:
publish-docker-image:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine release version
id: version
run: |
REF_NAME=${{github.ref_name}}
echo "REF_NAME: $REF_NAME"
VER=$(python3 -c 'import sys, re; print(re.match("temple-tasks-(.*)", sys.argv[1]).group(1))' $REF_NAME)
echo "VER: $VER"
echo "VER=$VER" >> $GITHUB_OUTPUT
- name: Build the tasks docker image
run: |
VER=${{ steps.version.outputs.VER }}
cd apps/automation-v2
docker build --file Dockerfile --tag temple-tasks:$VER .
docker build --file Dockerfile --tag temple-tasks:latest .
- name: Push image to ghcr
run: |
VER=${{ steps.version.outputs.VER }}
docker tag temple-tasks:$VER ghcr.io/templedao/temple-tasks:$VER
docker tag temple-tasks:latest ghcr.io/templedao/temple-tasks:latest
docker push ghcr.io/templedao/temple-tasks:$VER
docker push ghcr.io/templedao/temple-tasks:latest
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.TEMPLE_TASKS_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.TEMPLE_TASKS_AWS_SECRET_ACCESS_KEY }}
aws-region: ap-southeast-2
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
VER=${{ steps.version.outputs.VER }}
docker tag temple-tasks:$VER $ECR_REGISTRY/temple-tasks:$VER
docker push $ECR_REGISTRY/temple-tasks:$VER
docker tag temple-tasks:$VER $ECR_REGISTRY/temple-tasks:latest
docker push $ECR_REGISTRY/temple-tasks:latest