This repository has been archived by the owner on Jan 9, 2025. It is now read-only.
Bump docker/login-action from 3.2.0 to 3.3.0 #128
Workflow file for this run
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: Docker CI Release | |
on: | |
pull_request: | |
branches: main | |
push: | |
branches: main | |
tags: | |
- v* | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: "Git: Checkout" | |
uses: actions/checkout@v4 | |
- | |
name: "Docker: Setup QEMU" | |
id: qemu | |
uses: docker/[email protected] | |
- | |
name: "Docker: Setup Buildx" | |
id: buildx | |
uses: docker/[email protected] | |
- | |
name: "Docker: Available Platforms" | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- | |
name: "Env: Prepare" | |
id: prepare | |
run: | | |
PLATFORMS=linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/ppc64le | |
REPONAME=$(basename $GITHUB_REPOSITORY) | |
DOCKER_IMAGE=padhihomelab/${REPONAME#docker_} | |
VERSION=testing | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
VERSION=${GITHUB_REF#refs/tags/v} | |
VERSION=${VERSION#_} | |
fi | |
TAGS="${DOCKER_IMAGE}:${VERSION}" | |
if [[ $VERSION =~ ^(((([0-9]{1,3}\.){,3}[0-9]{1,4})|(git\..*))_){,4}((([0-9]{1,3}\.){,3}[0-9]{1,4})|(git\..*))(-p[0-9]{1,2})?$ ]]; then | |
TAGS="$TAGS,${DOCKER_IMAGE}:latest" | |
fi | |
echo ::set-output name=args::VERSION=${VERSION} \ | |
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ | |
--build-arg VCS_REF=${GITHUB_SHA::8} | |
echo ::set-output name=image::${DOCKER_IMAGE} | |
echo ::set-output name=platforms::${PLATFORMS} | |
echo ::set-output name=tags::${TAGS} | |
echo ::set-output name=version::${VERSION} | |
- | |
name: "Docker: Buildx Build" | |
uses: docker/[email protected] | |
with: | |
platforms: ${{ steps.prepare.outputs.platforms }} | |
push: false | |
tags: ${{ steps.prepare.outputs.tags }} | |
build-args: ${{ steps.prepare.outputs.args }} | |
- | |
name: "Docker: Load Image" | |
uses: docker/[email protected] | |
with: | |
load: true | |
push: false | |
tags: ${{ steps.prepare.outputs.tags }} | |
build-args: ${{ steps.prepare.outputs.args }} | |
- | |
name: "Anchore Scan: Run" | |
id: scan | |
uses: anchore/scan-action@v4 | |
with: | |
image: "${{ steps.prepare.outputs.image }}:${{ steps.prepare.outputs.version }}" | |
acs-report-enable: true | |
fail-build: false | |
severity-cutoff: "critical" | |
- | |
name: "Anchore Scan: Report" | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: ${{ steps.scan.outputs.sarif }} | |
- | |
name: "Docker Hub: Login" | |
if: success() && github.event_name != 'pull_request' | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- | |
name: "Docker: Buildx Push" | |
if: success() && github.event_name != 'pull_request' | |
uses: docker/[email protected] | |
with: | |
platforms: ${{ steps.prepare.outputs.platforms }} | |
push: true | |
tags: ${{ steps.prepare.outputs.tags }} | |
build-args: ${{ steps.prepare.outputs.args }} | |
- | |
name: "Docker Hub: Update description" | |
if: success() && github.event_name != 'pull_request' | |
uses: peter-evans/dockerhub-description@v4 | |
env: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
DOCKERHUB_REPOSITORY: ${{ steps.prepare.outputs.image }} | |
- | |
name: "Clean up" | |
if: always() | |
run: | | |
rm -f ${HOME}/.docker/config.json |