Skip to content
This repository was archived by the owner on May 27, 2026. It is now read-only.

build: dockerize

build: dockerize #7

Workflow file for this run

name: Build Lagrange.Milky
on:
push:
branches: [ main ]
paths:
- Lagrange.Codec/**
- Lagrange.Core/**
- Lagrange.Proto/**
- Lagrange.Proto.Generator/**
- Lagrange.Milky/**
pull_request:
branches: [ main ]
paths:
- Lagrange.Codec/**
- Lagrange.Core/**
- Lagrange.Proto/**
- Lagrange.Proto.Generator/**
- Lagrange.Milky/**
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
rid: win-x64
binary-extension: '.exe'
- os: macos-latest
rid: osx-arm64
binary-extension: ''
- os: ubuntu-latest
rid: linux-x64
binary-extension: ''
env:
RUNTIME_IDENTIFIER: ${{ matrix.rid }}
steps:
- name: Install Linux Dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y clang zlib1g-dev
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Checkout code
uses: actions/checkout@v4
- name: Publish
run: dotnet publish Lagrange.Milky -c Release -r ${{ matrix.rid }}
- name: Upload artifacts
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: Lagrange.Milky-${{ matrix.rid }}
path: Lagrange.Milky/bin/Release/net9.0/${{ matrix.rid }}/publish/Lagrange.Milky${{ matrix.binary-extension }}
docker:
needs: build
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: Lagrange.Milky-linux-x64
path: Lagrange.Milky/bin/Release/net9.0/linux-x64/publish/Lagrange.Milky
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Github Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/lagrange.milky
tags: |
type=edge
type=sha,event=branch
type=ref,event=tag
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: "Lagrange.Milky/Resources/Dockerfile"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}