change terraform to tofu #236
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: Build and Release Deploy Image | |
on: | |
push: | |
paths: | |
- 'deploy/**' | |
- '.github/workflows/deploy.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@v3 | |
with: | |
fetch-depth: 0 | |
- name: Log in to the Github Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Test Build for deploy | |
if: "${{ github.event_name == 'push' && ! contains(github.ref,'tag') }}" | |
uses: docker/build-push-action@v4 | |
with: | |
context: deploy | |
push: true | |
tags: ghcr.io/iaacautomation/deploy:test | |
platforms: linux/amd64,linux/arm64 | |
build-args: DISTRO=${{ vars.BASE_IMAGE }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Get tag | |
if: contains(github.ref,'tag') | |
id: tag | |
uses: dawidd6/action-get-tag@v1 | |
with: | |
strip_v: true | |
- name: Log in to the Docker Container registry | |
if: contains(github.ref,'tag') | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_ACCOUNT }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Log in to the Gitlab Container registry | |
if: contains(github.ref,'tag') | |
uses: docker/login-action@v2 | |
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@v4 | |
with: | |
context: deploy | |
push: true | |
tags: | | |
ghcr.io/iaacautomation/deploy:${{steps.tag.outputs.tag}} | |
ghcr.io/iaacautomation/deploy:latest | |
${{ secrets.GITLAB_REGISTRY_PATH }}/deploy:${{steps.tag.outputs.tag}} | |
${{ secrets.GITLAB_REGISTRY_PATH }}/deploy:latest | |
${{ secrets.DOCKERHUB_ACCOUNT }}/deploy:${{steps.tag.outputs.tag}} | |
${{ secrets.DOCKERHUB_ACCOUNT }}/deploy:latest | |
${{ secrets.ECR_REPO_PATH }}/deploy:${{steps.tag.outputs.tag}} | |
${{ secrets.ECR_REPO_PATH }}/deploy:latest | |
platforms: linux/amd64 ,linux/arm64 | |
build-args: DISTRO=${{ vars.BASE_IMAGE }} | |
cache-from: type=gha |