53 lines
1.6 KiB
YAML
53 lines
1.6 KiB
YAML
name: Build and Push Microservices
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
# Define a matrix to run this job for each microservice
|
|
strategy:
|
|
matrix:
|
|
service: [Sphere, Pass, Ring, Drive, Develop] # Add your service names here
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4 # Use the latest version
|
|
with:
|
|
fetch-depth: 0 # Required for NBGV
|
|
|
|
- name: Setup NBGV
|
|
uses: dotnet/nbgv@master
|
|
id: nbgv
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push Docker image for ${{ matrix.service }}
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
# Dynamically set the Dockerfile path based on the matrix service name
|
|
file: DysonNetwork.${{ matrix.service }}/Dockerfile
|
|
push: true
|
|
# Create two tags: one with the version number and one with 'latest'
|
|
tags: |
|
|
ghcr.io/${{ lower(github.repository_owner) }}/dyson-${{ lower(matrix.service) }}:${{ steps.nbgv.outputs.SimpleVersion }}
|
|
ghcr.io/${{ lower(github.repository_owner) }}/dyson-${{ lower(matrix.service) }}:latest
|
|
platforms: linux/amd64
|