This repository has been archived on 2025-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
Files
docker-salt-master/.github/workflows/publish.yml
dependabot[bot] b408a981ac build(deps): Bump docker/login-action from 1.13.0 to 1.14.1
Bumps [docker/login-action](https://github.com/docker/login-action) from 1.13.0 to 1.14.1.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v1.13.0...v1.14.1)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-06 09:51:15 +00:00

126 lines
3.6 KiB
YAML

name: Publish Docker image
on:
push:
branches:
- main
paths-ignore:
- './**/*.md'
- 'LICENSE'
release:
types:
- published
env:
IMAGE_NAME: cdalvaro/docker-salt-master
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7
CACHE_PATH: /tmp/.buildx-docker-salt-master-cache
EXTRA_REGISTRIES: ghcr.io quay.io
jobs:
metadata:
name: Metadata
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.tags.outputs.tags }}
vcs_ref: ${{ steps.vcs_ref.outputs.vcs_ref }}
created_on: ${{ steps.created_on.outputs.created_on }}
steps:
- name: Image Tags
id: tags
run: |
IMAGE_TAG="${{ github.event.release.tag_name }}"
[ -z "${IMAGE_TAG}" ] && IMAGE_TAG='latest'
DOCKER_IMAGE="${IMAGE_NAME}:${IMAGE_TAG}"
TAGS="${DOCKER_IMAGE}"
for registry in ${EXTRA_REGISTRIES}; do
TAGS="${TAGS},${registry}/${DOCKER_IMAGE}"
done
echo "Image Tag: '${IMAGE_TAG}'"
echo "Docker image: '${DOCKER_IMAGE}'"
echo "Tags: ${TAGS}"
echo ::set-output name=tags::${TAGS}
- name: VCS ref
id: vcs_ref
run: |
VCS_REF="${GITHUB_SHA::8}"
echo "VCS ref: ${VCS_REF}"
echo ::set-output name=vcs_ref::${VCS_REF}
- name: Created On
id: created_on
run: |
CREATED_ON="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
echo "Created on: ${CREATED_ON}"
echo ::set-output name=created_on::${CREATED_ON}
- name: Dump environment
if: contains(toJSON(github.event.commits.*.message), 'ci(debug)') == true
run: env | sort
- name: Dump GitHub context
if: contains(toJSON(github.event.commits.*.message), 'ci(debug)') == true
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "${GITHUB_CONTEXT}"
publish:
name: Publish
runs-on: ubuntu-latest
needs: metadata
if: contains(toJSON(github.event.commits.*.message), 'ci(debug)') == false
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v1.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1.6.0
- name: Cache Docker layers
uses: actions/cache@v2.1.7
with:
path: ${{ env.CACHE_PATH }}
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to Docker Container Registry
uses: docker/login-action@v1.14.1
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1.14.1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Login to Quay.io Container Registry
uses: docker/login-action@v1.14.1
with:
registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_PASSWORD }}
- name: Build
uses: docker/build-push-action@v2.9.0
with:
context: .
file: ./Dockerfile
platforms: ${{ env.PLATFORMS }}
build-args: |
VCS_REF=${{ needs.metadata.outputs.vcs_ref }}
BUILD_DATE=${{ needs.metadata.outputs.created_on }}
cache-from: type=local,src=${{ env.CACHE_PATH }}
cache-to: type=local,dest=${{ env.CACHE_PATH }}
push: true
tags: ${{ needs.metadata.outputs.tags }}