Skip to content

Merge pull request #329 from cdalvaro/dependabot/github_actions/actio… #397

Merge pull request #329 from cdalvaro/dependabot/github_actions/actio…

Merge pull request #329 from cdalvaro/dependabot/github_actions/actio… #397

Workflow file for this run

name: Publish Docker Image
on:
push:
branches:
- main
paths-ignore:
- "./**/*.md"
- "docs/"
- "social/"
- ".editorconfig"
- ".gitignore"
- ".shellcheckrc"
- "compose.yml"
- "LICENSE"
- "Makefile"
release:
types:
- published
env:
IMAGE_NAME: ${{ github.repository }}
PLATFORMS: linux/amd64,linux/arm64
EXTRA_REGISTRIES: ghcr.io quay.io public.ecr.aws
jobs:
metadata:
name: Metadata
runs-on: ubuntu-24.04
outputs:
salt_version: ${{ steps.salt_version.outputs.salt_version }}
tags: ${{ steps.tags.outputs.tags }}
tags_gui: ${{ steps.tags_gui.outputs.tags_gui }}
vcs_ref: ${{ steps.vcs_ref.outputs.vcs_ref }}
created_on: ${{ steps.created_on.outputs.created_on }}
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Salt Version
id: salt_version
run: |
source .github/workflows/ci_tools.sh
export_salt_version salt_version "${{ github.event.release.name }}"
- name: Base Image Tags
id: tags
run: |
source .github/workflows/ci_tools.sh
export_image_tags tags "${{ github.event.release.name }}" "${{ github.event.release.tag_name }}" ""
- name: GUI Image Tags
id: tags_gui
run: |
source .github/workflows/ci_tools.sh
export_image_tags tags_gui "${{ github.event.release.name }}" "${{ github.event.release.tag_name }}" "gui"
- name: VCS Ref
id: vcs_ref
run: |
VCS_REF="${GITHUB_SHA::8}"
echo "VCS ref: ${VCS_REF}"
echo "vcs_ref=${VCS_REF}" >> $GITHUB_OUTPUT
- name: Created On
id: created_on
run: |
CREATED_ON="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
echo "Created on: ${CREATED_ON}"
echo "created_on=${CREATED_ON}" >> $GITHUB_OUTPUT
publish:
name: Publish
runs-on: ubuntu-24.04
permissions:
id-token: write
contents: read
needs: metadata
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Set Up QEMU
uses: docker/setup-qemu-action@v3
- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Container Registry
uses: docker/login-action@v3
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Login to Quay.io Container Registry
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_PASSWORD }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v5
with:
role-to-assume: arn:aws:iam::527345795889:role/github-ecr
aws-region: us-east-1
- name: Login to Amazon ECR Public
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public
- name: Build and Publish Base Image
uses: docker/build-push-action@v6.18.0
with:
context: .
file: ./Dockerfile
platforms: ${{ env.PLATFORMS }}
build-args: |
VCS_REF=${{ needs.metadata.outputs.vcs_ref }}
BUILD_DATE=${{ needs.metadata.outputs.created_on }}
SALT_VERSION=${{ needs.metadata.outputs.salt_version }}
outputs: |
type=image,annotation-index.org.opencontainers.image.description=https://github.com/${{ github.repository }}
cache-from: type=gha
cache-to: type=gha,mode=max
pull: true
push: true
tags: ${{ needs.metadata.outputs.tags }}
- name: Build and Publish SaltGUI Image
uses: docker/build-push-action@v6.18.0
with:
context: .
file: ./Dockerfile.gui
platforms: ${{ env.PLATFORMS }}
build-args: |
VCS_REF=${{ needs.metadata.outputs.vcs_ref }}
BUILD_DATE=${{ needs.metadata.outputs.created_on }}
BASE_TAG=${{ github.event.release.tag_name || 'latest' }}
outputs: |
type=image,annotation-index.org.opencontainers.image.description=https://github.com/${{ github.repository }}
cache-from: type=gha
cache-to: type=gha,mode=max
pull: true
push: true
tags: ${{ needs.metadata.outputs.tags_gui }}