chore: change favicon #75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker build and push to repository | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
main_build_image: | |
permissions: | |
actions: write | |
runs-on: ubuntu-latest | |
outputs: | |
shortref: ${{ steps.prep.outputs.shortref }} | |
tags: ${{ steps.prep.outputs.tags }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.ECR_PUBLIC_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.ECR_PUBLIC_SECRET_KEY }} | |
aws-region: us-east-1 | |
- name: Login to Amazon ECR | |
id: login-ecr-public | |
uses: aws-actions/amazon-ecr-login@v2 | |
with: | |
registry-type: public | |
- name: Prepare | |
id: prep | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr-public.outputs.registry }} | |
ECR_REGISTRY_ALIAS: d6h3d6x3 | |
ECR_REPOSITORY: amboss-banco | |
run: | | |
DOCKER_IMAGE=$ECR_REGISTRY/$ECR_REGISTRY_ALIAS/$ECR_REPOSITORY | |
SHORTREF=${GITHUB_SHA::8} | |
TAGS="${DOCKER_IMAGE}:${SHORTREF}" | |
# Set output parameters. | |
echo "shortref=${SHORTREF}" >> $GITHUB_OUTPUT | |
echo "tags=${TAGS}" >> $GITHUB_OUTPUT | |
- name: Check Image | |
id: image_check | |
env: | |
ECR_TAG: ${{ steps.prep.outputs.tags }} | |
run: docker manifest inspect $ECR_TAG && echo "imageExists=true" >> $GITHUB_OUTPUT || echo "imageExists=false" >> $GITHUB_OUTPUT | |
- name: Setup Docker Buildx Driver | |
id: docker_driver_setup | |
if: ${{ steps.image_check.outputs.imageExists == 'false' }} | |
uses: docker/setup-buildx-action@v3 | |
- name: Build, tag, and push image to Amazon ECR | |
id: docker_build | |
if: ${{ steps.image_check.outputs.imageExists == 'false' }} | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ | |
file: ./Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.prep.outputs.tags }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Build Outputs | |
if: ${{ steps.image_check.outputs.imageExists == 'false' }} | |
run: | | |
echo "Image ID: ${{ steps.docker_build.outputs.imageid }}" | |
echo "Image Digest: ${{ steps.docker_build.outputs.digest }}" | |
- name: Trigger Deployment | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: | | |
# Set the required variables | |
repo_owner="AmbossTech" | |
repo_name="amboss-banco-ci" | |
event_type="trigger-workflow" | |
gh workflow -R $repo_owner/$repo_name -r main run deploy-banco-prod.yaml -f tag=${{ steps.prep.outputs.shortref }} |