mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-18 09:15:13 +00:00
Github workflow to build and deploy docker image
This commit is contained in:
parent
cafae6b562
commit
f8ac6c0243
1 changed files with 75 additions and 0 deletions
75
.github/workflows/deploy.yml
vendored
Normal file
75
.github/workflows/deploy.yml
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
name: Build and deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
tags:
|
||||
- '*.*.*'
|
||||
- 'v*.*.*'
|
||||
|
||||
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
|
||||
-
|
||||
id : qemu
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
with:
|
||||
platforms: amd64,arm64
|
||||
-
|
||||
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/arm64
|
||||
cache-from : type=gha,scope=${{ github.workflow }}
|
||||
cache-to : type=gha,scope=${{ github.workflow }},mode=max
|
Loading…
Reference in a new issue