54 lines
1.5 KiB
YAML
54 lines
1.5 KiB
YAML
name: HA Build & Push to ECR
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- main
|
|
- "feat/ha-*"
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: [self-hosted, k3s, linux, amd64]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Configure AWS credentials
|
|
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
|
|
with:
|
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
aws-region: ${{ secrets.AWS_REGION }}
|
|
|
|
- name: Login to Amazon ECR
|
|
id: ecr-login
|
|
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
|
|
|
|
- name: Set image metadata
|
|
id: meta
|
|
run: |
|
|
REPO="${{ steps.ecr-login.outputs.registry }}/${{ secrets.ECR_REPOSITORY }}"
|
|
SHORT_SHA="${GITHUB_SHA::7}"
|
|
echo "image_repo=${REPO}" >> "$GITHUB_OUTPUT"
|
|
echo "short_sha=${SHORT_SHA}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build and push image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
platforms: linux/amd64
|
|
push: true
|
|
provenance: false
|
|
tags: |
|
|
${{ steps.meta.outputs.image_repo }}:${{ steps.meta.outputs.short_sha }}
|
|
${{ steps.meta.outputs.image_repo }}:latest
|