mirror of
https://github.com/m1k1o/neko-rooms.git
synced 2026-11-03 07:01:35 -06:00
80 lines
2.3 KiB
YAML
80 lines
2.3 KiB
YAML
name: "CI for builds"
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
build-client:
|
|
name: Build Client Artifacts
|
|
uses: ./.github/workflows/client_build.yml
|
|
|
|
build-and-push:
|
|
name: Build and Push Docker Image
|
|
runs-on: ubuntu-latest
|
|
needs: build-client
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Download client dist
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: client
|
|
path: client/dist
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
uses: docker/metadata-action@v5
|
|
id: meta
|
|
with:
|
|
images: |
|
|
docker.io/${{ github.repository }}
|
|
ghcr.io/${{ github.repository }}
|
|
tags: |
|
|
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.DOCKER_TOKEN }}
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GHCR_ACCESS_TOKEN }}
|
|
|
|
- name: Remove client stage from Dockerfile
|
|
# Change dockerfile: remove first stage - everything between # STAGE 1 and # STAGE 2
|
|
# Replace "--from=frontend /src/dist/" with "./client/dist/"
|
|
run: |
|
|
sed -i '/# STAGE 1/,/# STAGE 2/d' ./Dockerfile
|
|
sed -i 's/--from=frontend \/src\/dist\//.\/client\/dist\//g' ./Dockerfile
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: ./
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|