Merge pull request #3 from iaacautomation/update-tools #76
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: Azure Deploy Docker Image | |
on: | |
push: | |
paths: | |
- 'deploy-azure/**' | |
- '.github/workflows/deploy-azure.yaml' | |
jobs: | |
release: | |
name: Build and Release Deploy Image | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
id-token: write | |
contents: write | |
pull-requests: write | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Github Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Log in to the Docker Container registry | |
if: contains(github.ref,'tag') | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_ACCOUNT }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Test Build for deploy-azure | |
if: "${{ github.event_name == 'push' && ! contains(github.ref,'tag') }}" | |
uses: docker/build-push-action@v5 | |
with: | |
context: deploy-azure | |
push: true | |
tags: ghcr.io/iaacautomation/deploy-azure:test | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Get tag | |
if: contains(github.ref,'tag') | |
id: tag | |
uses: devops-actions/[email protected] | |
with: | |
strip_v: true | |
- name: Log in to the Gitlab Container registry | |
if: contains(github.ref,'tag') | |
uses: docker/login-action@v3 | |
with: | |
registry: registry.gitlab.com | |
username: ${{ secrets.GITLAB_ACCOUNT }} | |
password: ${{ secrets.GITLAB_TOKEN }} | |
- name: Configure AWS credentials | |
if: contains(github.ref,'tag') | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-region: us-east-1 | |
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | |
role-duration-seconds: 900 | |
role-session-name: GitHub | |
- name: Login to Amazon ECR | |
if: contains(github.ref,'tag') | |
run: aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${{ secrets.ECR_REPO_PATH }} | |
- name: Build and Push images | |
if: contains(github.ref,'tag') | |
uses: docker/build-push-action@v5 | |
with: | |
context: deploy-azure | |
push: true | |
tags: | | |
ghcr.io/iaacautomation/deploy-azure:${{steps.tag.outputs.tag}} | |
ghcr.io/iaacautomation/deploy-azure:latest | |
${{ secrets.GITLAB_REGISTRY_PATH }}/deploy-azure:latest | |
${{ secrets.DOCKERHUB_ACCOUNT }}/deploy-azure:${{steps.tag.outputs.tag}} | |
${{ secrets.DOCKERHUB_ACCOUNT }}/deploy-azure:latest | |
${{ secrets.ECR_REPO_PATH }}/deploy-azure:${{steps.tag.outputs.tag}} | |
${{ secrets.ECR_REPO_PATH }}/deploy-azure:latest | |
platforms: linux/amd64 ,linux/arm64 | |
cache-from: type=gha |