mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-22 03:05:16 +00:00
f948a05bd3
for Build and Deploy
75 lines
1.9 KiB
YAML
75 lines
1.9 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
|