Files
MediaLore-Web-App/.gitea/workflows/container-publish.yml
Garret Patti 2b0b19eb91 add auth
2026-06-29 10:41:29 -04:00

94 lines
2.6 KiB
YAML

name: Container Publish
on:
push:
branches: [main]
tags: ["v*"]
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v3
- name: Extract metadata
id: meta
run: |
REGISTRY=git.gpatti.com
OWNER="${{ gitea.repository_owner }}"
IMAGE_NAME="${REGISTRY}/${OWNER}/medialore-backend"
echo "image=${IMAGE_NAME}" >> "$GITHUB_OUTPUT"
echo "registry=${REGISTRY}" >> "$GITHUB_OUTPUT"
if [[ "${{ gitea.ref_type }}" == "tag" ]]; then
TAG="${{ gitea.ref_name }}"
VERSION="${TAG#v}"
echo "tags=${IMAGE_NAME}:${VERSION},${IMAGE_NAME}:latest" >> "$GITHUB_OUTPUT"
else
echo "tags=${IMAGE_NAME}:latest" >> "$GITHUB_OUTPUT"
fi
- name: Log in to registry
run: |
echo "${{ secrets.REGISTRY_TOKEN }}" | \
docker login "${{ steps.meta.outputs.registry }}" \
-u "${{ secrets.REGISTRY_USER }}" \
--password-stdin
- name: Build and push
uses: https://github.com/docker/build-push-action@v6
with:
context: ./backend
push: true
tags: ${{ steps.meta.outputs.tags }}
frontend:
runs-on: ubuntu-latest
needs: []
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v3
- name: Extract metadata
id: meta
run: |
REGISTRY=git.gpatti.com
OWNER="${{ gitea.repository_owner }}"
IMAGE_NAME="${REGISTRY}/${OWNER}/medialore-frontend"
echo "image=${IMAGE_NAME}" >> "$GITHUB_OUTPUT"
echo "registry=${REGISTRY}" >> "$GITHUB_OUTPUT"
if [[ "${{ gitea.ref_type }}" == "tag" ]]; then
TAG="${{ gitea.ref_name }}"
VERSION="${TAG#v}"
echo "tags=${IMAGE_NAME}:${VERSION},${IMAGE_NAME}:latest" >> "$GITHUB_OUTPUT"
else
echo "tags=${IMAGE_NAME}:latest" >> "$GITHUB_OUTPUT"
fi
- name: Log in to registry
run: |
echo "${{ secrets.REGISTRY_TOKEN }}" | \
docker login "${{ steps.meta.outputs.registry }}" \
-u "${{ secrets.REGISTRY_USER }}" \
--password-stdin
- name: Build and push
uses: https://github.com/docker/build-push-action@v6
with:
context: ./frontend
push: true
tags: ${{ steps.meta.outputs.tags }}