mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-25 12:45:18 +00:00
107 lines
2.8 KiB
YAML
107 lines
2.8 KiB
YAML
name: Build and deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '**'
|
|
tags:
|
|
- '*.*.*'
|
|
- 'v*.*.*'
|
|
workflow_dispatch: # or manual
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
IMAGE: ${{ github.repository_owner }}/smo-online-server
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
-
|
|
name: Environment
|
|
run: |
|
|
IMAGE=`echo ${{ env.IMAGE }} | tr '[:upper:]' '[:lower:]'`
|
|
echo "IMAGE=$IMAGE" >>$GITHUB_ENV
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v3
|
|
-
|
|
id: meta
|
|
name: Docker meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: |
|
|
ghcr.io/${{ env.IMAGE }}
|
|
flavor: |
|
|
latest=false
|
|
tags: |
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
type=semver,pattern={{major}}.{{minor}}.{{patch}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
type=ref,event=branch
|
|
labels: |
|
|
org.opencontainers.image.licenses=UNLICENSED
|
|
-
|
|
name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
with:
|
|
platforms: amd64,arm64,arm
|
|
-
|
|
name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
-
|
|
name: Login to GHCR
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry : ghcr.io
|
|
username : ${{ github.repository_owner }}
|
|
password : ${{ secrets.GITHUB_TOKEN }}
|
|
-
|
|
name: Build and push
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
pull : true
|
|
push : true
|
|
context : .
|
|
file : ./Dockerfile
|
|
tags : ${{ steps.meta.outputs.tags }}
|
|
labels : ${{ steps.meta.outputs.labels }}
|
|
platforms : linux/amd64,linux/arm/v7,linux/arm64/v8
|
|
cache-from : type=gha,scope=${{ github.workflow }}
|
|
cache-to : type=gha,scope=${{ github.workflow }},mode=max
|
|
-
|
|
name: Build binary files
|
|
run: |
|
|
./docker-build.sh all
|
|
-
|
|
name : Upload Server
|
|
uses : actions/upload-artifact@v3
|
|
with:
|
|
name : Server
|
|
path : ./bin/Server
|
|
if-no-files-found : error
|
|
-
|
|
name : Upload Server.arm
|
|
uses : actions/upload-artifact@v3
|
|
with:
|
|
name : Server.arm
|
|
path : ./bin/Server.arm
|
|
if-no-files-found : error
|
|
-
|
|
name : Upload Server.arm64
|
|
uses : actions/upload-artifact@v3
|
|
with:
|
|
name : Server.arm64
|
|
path : ./bin/Server.arm64
|
|
if-no-files-found : error
|
|
-
|
|
name : Upload Server.exe
|
|
uses : actions/upload-artifact@v3
|
|
with:
|
|
name : Server.exe
|
|
path : ./bin/Server.exe
|
|
if-no-files-found : error
|