chore(deps): bump docker/build-push-action from 5 to 6 (#40) #165
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: Alpine | |
on: | |
release: | |
types: | |
- published | |
push: | |
branches: | |
- master | |
paths: | |
- .github/workflows/alpine.yml | |
- shell/** | |
- .dockerignore | |
- alpine.Dockerfile | |
pull_request: | |
paths: | |
- .github/workflows/alpine.yml | |
- shell/** | |
- .dockerignore | |
- alpine.Dockerfile | |
jobs: | |
verify: | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_BUILDKIT: "1" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build image | |
run: docker build -f alpine.Dockerfile -t qmcgaw/godevcontainer . | |
publish: | |
if: | | |
github.repository == 'qdm12/godevcontainer' && | |
( | |
github.event_name == 'push' || | |
github.event_name == 'release' || | |
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]') | |
) | |
needs: [verify] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# extract metadata (tags, labels) for Docker | |
# https://github.com/docker/metadata-action | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
flavor: | | |
latest=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
images: | | |
qmcgaw/godevcontainer | |
tags: | | |
type=ref,event=pr | |
type=semver,pattern=v{{major}}.{{minor}}.{{patch}}-alpine | |
type=semver,pattern=v{{major}}.{{minor}}-alpine | |
type=raw,value=alpine,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v2 | |
with: | |
username: qmcgaw | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Short commit | |
id: shortcommit | |
run: echo "::set-output name=value::$(git rev-parse --short HEAD)" | |
- name: Build and push final image | |
uses: docker/build-push-action@v6 | |
with: | |
file: alpine.Dockerfile | |
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6 | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
CREATED=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} | |
COMMIT=${{ steps.shortcommit.outputs.value }} | |
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} | |
tags: ${{ steps.meta.outputs.tags }} | |
push: true |