Skip to content

Resolve actual version for floating major-version tags via digest lookup #44

Resolve actual version for floating major-version tags via digest lookup

Resolve actual version for floating major-version tags via digest lookup #44

Workflow file for this run

name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Login to GHCR
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate tags
id: tags
run: |
if [ "${{ github.event_name }}" = "push" ] && [ "${{ github.ref }}" = "refs/heads/main" ]; then
SHA_SHORT=$(echo ${{ github.sha }} | cut -c1-7)
echo "tags=ghcr.io/chrisae9/docksmith:main,ghcr.io/chrisae9/docksmith:sha-${SHA_SHORT}" >> $GITHUB_OUTPUT
echo "push=true" >> $GITHUB_OUTPUT
else
echo "tags=" >> $GITHUB_OUTPUT
echo "push=false" >> $GITHUB_OUTPUT
fi
- uses: docker/build-push-action@v6
with:
context: .
push: ${{ steps.tags.outputs.push }}
tags: ${{ steps.tags.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max