79 lines
2.1 KiB
YAML
79 lines
2.1 KiB
YAML
env:
|
|
REGISTRY: ghcr.io
|
|
ECR_REGISTRY: 976079455550.dkr.ecr.us-east-1.amazonaws.com
|
|
IMAGE_NAME: ${{ github.repository }}-multiplayer
|
|
|
|
name: Publish websocket multiplayer server
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
packages: write
|
|
|
|
jobs:
|
|
publish_multiplayer:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: depot/setup-action@v1
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: |
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
- name: Login to registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push publicly
|
|
uses: depot/build-push-action@v1
|
|
with:
|
|
context: .
|
|
file: ./docker/DockerfileMultiplayer
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: |
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
${{ steps.meta.outputs.tags }}
|
|
labels: |
|
|
${{ steps.meta.outputs.labels }}
|
|
org.opencontainers.image.licenses=AGPLv3
|
|
|
|
publish_privately:
|
|
needs: [publish_multiplayer]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Login to ECR
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ${{ env.ECR_REGISTRY }}
|
|
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
|
|
- name: Push image to ECR
|
|
run: |
|
|
docker buildx imagetools create \
|
|
--tag ${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest |