revert: remove .github/workflows/admin-web-docker.yml (did not exist at 29caf1a)
This commit is contained in:
109
.github/workflows/admin-web-docker.yml
vendored
109
.github/workflows/admin-web-docker.yml
vendored
@@ -1,109 +0,0 @@
|
||||
# =============================================================================
|
||||
# TabataGo — Admin Web Docker Build & Push to Gitea Container Registry
|
||||
# =============================================================================
|
||||
#
|
||||
# Gitea Registry URL: gitea.1000co.fr/millianlmx/tabatago/admin-web
|
||||
#
|
||||
# Required secrets:
|
||||
# PR_API_TOKEN — Gitea PAT (must have read:package + write:package scopes)
|
||||
# =============================================================================
|
||||
|
||||
name: Admin Web — Docker Build & Push
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'admin-web/**'
|
||||
- '.github/workflows/admin-web-docker.yml'
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'admin-web/**'
|
||||
- '.github/workflows/admin-web-docker.yml'
|
||||
|
||||
env:
|
||||
REGISTRY: gitea.1000co.fr
|
||||
IMAGE_NAME: ${{ github.repository }}/admin-web
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
name: Build & Push Docker Image
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# ── Metadata: image tags & labels ──
|
||||
- name: Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=sha,prefix=,format=short
|
||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
labels: |
|
||||
org.opencontainers.image.title=TabataGo Admin Web
|
||||
org.opencontainers.image.description=Next.js admin dashboard for TabataGo
|
||||
org.opencontainers.image.vendor=Millian LMX
|
||||
|
||||
# ── Login to Gitea Container Registry ──
|
||||
- name: Login to Gitea Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.PR_API_TOKEN }}
|
||||
|
||||
# ── Build & Push ──
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: admin-web
|
||||
file: admin-web/Dockerfile
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
platforms: linux/amd64
|
||||
|
||||
# ── PR comment with image info ──
|
||||
- name: Post PR image info
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const sha = context.sha.substring(0, 7);
|
||||
const image = `${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:pr-${{ github.event.pull_request.number }}`;
|
||||
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: [
|
||||
'## 🐳 Docker Image Built',
|
||||
'',
|
||||
'| | |',
|
||||
'|---|---|',
|
||||
`| **Image** | \`${image}\` |`,
|
||||
`| **Commit** | \`${sha}\` |`,
|
||||
'',
|
||||
'Pull the image:',
|
||||
'```bash',
|
||||
`docker pull ${image}`,
|
||||
'```',
|
||||
].join('\n')
|
||||
});
|
||||
Reference in New Issue
Block a user