Update docker.io/library/alpine Docker tag to v3.21.2 #549
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 publish | |
on: | |
push: | |
branches: main | |
# Publish semantic version tags as releases | |
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ] | |
pull_request: | |
branches: main | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{github.repository}} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
# Login against a Docker registry except on PR | |
- name: Log into Docker registry ${{env.REGISTRY}} | |
if: github.event_name != 'pull_request' | |
uses: docker/[email protected] | |
with: | |
registry: ${{env.REGISTRY}} | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
# Extract metadata for Docker for subsequent registry push | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: ${{env.REGISTRY}}/${{env.IMAGE_NAME}} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
# Build and push Docker image with Buildx (don't push on PR) | |
- name: Build and push Docker image | |
uses: docker/[email protected] | |
with: | |
context: . | |
push: ${{github.event_name != 'pull_request'}} | |
tags: ${{steps.meta.outputs.tags}} | |
labels: ${{steps.meta.outputs.labels}} |