Bump docker/build-push-action from 3 to 4 #107
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: Build and push the container image | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: | |
- master | |
pull_request: | |
release: | |
types: [published] | |
jobs: | |
lint: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Super-Linter | |
uses: github/[email protected] | |
env: | |
DISABLE_ERRORS: false | |
ERROR_ON_MISSING_EXEC_BIT: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LINTER_RULES_PATH: . | |
VALIDATE_ALL_CODEBASE: true | |
VALIDATE_JSCPD_ALL_CODEBASE: true | |
build-container-images: | |
env: | |
CONTAINER_IMAGE_ID: "ferrarimarco/pxe" | |
needs: | |
- lint | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Generate container image metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
"${{ env.CONTAINER_IMAGE_ID }}" | |
"ghcr.io/${{ env.CONTAINER_IMAGE_ID }}" | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}}.{{patch}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build the container image | |
uses: docker/build-push-action@v4 | |
with: | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
context: . | |
load: true | |
push: false | |
tags: | | |
"${{ env.CONTAINER_IMAGE_ID }}" | |
- name: Run a quick test case | |
run: | | |
docker run --rm ${{ env.CONTAINER_IMAGE_ID }} --version | |
- name: Login to Docker Hub | |
if: | | |
github.repository == 'ferrarimarco/docker-pxe' | |
&& (github.ref == 'refs/heads/master' || | |
(github.event_name == 'release' && github.event.action == 'published') | |
) | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
if: | | |
github.repository == 'ferrarimarco/docker-pxe' | |
&& (github.ref == 'refs/heads/master' || | |
(github.event_name == 'release' && github.event.action == 'published') | |
) | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push the container image | |
uses: docker/build-push-action@v4 | |
with: | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
context: . | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
# Can't use multi-line string because GitHub Actions doesn't correctly parse them | |
# unless they're for an `if`, that doesn't need `${{ }}`. | |
# See https://docs.github.com/en/actions/learn-github-actions/expressions#about-expressions | |
push: ${{ github.repository == 'ferrarimarco/docker-pxe' && (github.ref == 'refs/heads/master' || (github.event_name == 'release' && github.event.action == 'published'))}} | |
tags: ${{ steps.meta.outputs.tags }} | |
- if: | | |
github.repository == 'ferrarimarco/docker-pxe' | |
&& (github.ref == 'refs/heads/master' || | |
(github.event_name == 'release' && github.event.action == 'published') | |
) | |
name: Update repo description | |
uses: peter-evans/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
repository: "${{ env.CONTAINER_IMAGE_ID }}" | |
short-description: "https://github.com/ferrarimarco/docker-pxe" | |
... |