Update docker/build-push-action action to v6 #72
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: Publish Docker image | |
on: | |
release: | |
types: [published] | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
push_to_registries: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {name: imongr} | |
name: Image shinyproxy-${{ matrix.config.name }} | |
steps: | |
- name: Check out the repo | |
uses: actions/[email protected] | |
- name: Lint Dockerfile | |
uses: hadolint/[email protected] | |
with: | |
dockerfile: "${{ matrix.config.name }}/Dockerfile" | |
- name: Prepare tags | |
id: docker_meta | |
uses: docker/[email protected] | |
with: | |
images: hnskde/shinyproxy-${{ matrix.config.name }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push to Docker Hub | |
uses: docker/[email protected] | |
with: | |
context: ./${{ matrix.config.name }} | |
platforms: linux/amd64,linux/arm64 | |
file: ./${{ matrix.config.name }}/Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
build-args: GH_PAT=${{ secrets.GITHUB_TOKEN }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |