70 lines
2 KiB
YAML
Executable file
70 lines
2 KiB
YAML
Executable file
name: Docker Build & Push
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log into Forgejo Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.khoavo.myds.me
|
|
username: ${{ secrets.FORGEJO_USERNAME }}
|
|
password: ${{ secrets.FORGEJO_PASSWORD }}
|
|
|
|
- name: Extract metadata (backend)
|
|
id: meta-backend
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: git.khoavo.myds.me/${{ github.repository }}-backend
|
|
tags: |
|
|
type=semver,pattern={{version}}
|
|
type=raw,value=latest,enable=${{ github.ref == 'refs/tags/v*' }}
|
|
|
|
- name: Build and push (backend)
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./backend
|
|
push: true
|
|
tags: ${{ steps.meta-backend.outputs.tags }}
|
|
labels: ${{ steps.meta-backend.outputs.labels }}
|
|
platforms: linux/amd64
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
- name: Extract metadata (frontend)
|
|
id: meta-frontend
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: git.khoavo.myds.me/${{ github.repository }}-frontend
|
|
tags: |
|
|
type=semver,pattern={{version}}
|
|
type=raw,value=latest,enable=${{ github.ref == 'refs/tags/v*' }}
|
|
|
|
- name: Build and push (frontend)
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./frontend
|
|
push: true
|
|
tags: ${{ steps.meta-frontend.outputs.tags }}
|
|
labels: ${{ steps.meta-frontend.outputs.labels }}
|
|
platforms: linux/amd64
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|