Update docker.yml

This commit is contained in:
2025-11-07 09:52:50 +01:00
parent 6362887d0c
commit f95147da54

View File

@@ -1,19 +1,44 @@
name: Build & Push Frontend name: Build & Push Frontend A
on: on:
push: push:
branches: [ main ] branches: ['**']
jobs: jobs:
docker: docker:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Prepare tag (sanitize branch)
id: prep
run: |
BRANCH="${GITHUB_REF_NAME}"
BRANCH="${BRANCH//\//-}"
BRANCH="$(echo "$BRANCH" | tr '[:upper:]' '[:lower:]')"
echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"
echo "sha=${GITHUB_SHA::12}" >> "$GITHUB_OUTPUT"
- uses: docker/setup-buildx-action@v3 - uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3 - uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v6
- name: Build & Push (branch + sha tags)
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/playground:frontend-a-${{ steps.prep.outputs.branch }}
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/playground:frontend-a-${{ steps.prep.outputs.branch }}-${{ steps.prep.outputs.sha }}
- name: Also push moving main tag (only on main)
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
with: with:
context: . context: .
push: true push: true
tags: docker.io/${{ secrets.DOCKERHUB_USERNAME }}/playground:frontend-main tags: |
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/playground:frontend-a-main