mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-01-05 09:39:22 -08:00
feat: build and release docker images using github actions and container registry (#5807)
* feat: build and release docker images using github cicd * fix: attempt to publish to specific image name * fix: typo in pipeline step * typo * typo * limit to certain paths for PRs & naming * ci: configure image title and url * docker: include only necessary files and directories this should make caching more powerful * docker: reorder COPY with best guess of what changes least * build(docker): remove seemingly unnecessary files * fix: clean up docker metadata remove annotations, it seems they're applied from the labels already, add description * fix(ci): add back docker image annotations * Update desktop-build.yml * Update desktop-lint.yml * Update desktop-build.yml * Update docker-release.yml * fix: remove run on master and add affected files to PR trigger * metadata * ci: run pipeline on main this will ensure the container can always build and keep caches ready for release. push should only happen on tag triggers It also removes some files from the PR trigger that should never break the build, and would just invalidate cache. * Update docker-release.yml --------- Co-authored-by: tooomm <tooomm@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
700feb68af
commit
baa7e25e30
1
.github/workflows/desktop-build.yml
vendored
1
.github/workflows/desktop-build.yml
vendored
@@ -9,6 +9,7 @@ on:
|
||||
- 'webclient/**'
|
||||
- '.github/workflows/web-*.yml'
|
||||
- '.github/workflows/translations-*.yml'
|
||||
- '.github/workflows/docker-release.yml'
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
|
||||
1
.github/workflows/desktop-lint.yml
vendored
1
.github/workflows/desktop-lint.yml
vendored
@@ -7,6 +7,7 @@ on:
|
||||
- 'webclient/**'
|
||||
- '.github/workflows/web-*.yml'
|
||||
- '.github/workflows/translations-*.yml'
|
||||
- '.github/workflows/docker-release.yml'
|
||||
|
||||
jobs:
|
||||
format:
|
||||
|
||||
71
.github/workflows/docker-release.yml
vendored
Normal file
71
.github/workflows/docker-release.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
name: Build Docker Container
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*Release*'
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- '.github/workflows/docker-release.yml'
|
||||
- 'CMakeLists.txt'
|
||||
- 'Dockerfile'
|
||||
- 'servatrice/**'
|
||||
- 'common/**'
|
||||
- 'cmake/**'
|
||||
- '!**.md'
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
name: amd64 & arm64
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Docker metadata
|
||||
id: metadata
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
ghcr.io/cockatrice/servatrice
|
||||
labels: |
|
||||
org.opencontainers.image.title=Servatrice
|
||||
org.opencontainers.image.url=https://cockatrice.github.io/
|
||||
org.opencontainers.image.description=Server for Cockatrice, a cross-platform virtual tabletop for multiplayer card games
|
||||
annotations: |
|
||||
org.opencontainers.image.title=Servatrice
|
||||
org.opencontainers.image.url=https://cockatrice.github.io/
|
||||
org.opencontainers.image.description=Server for Cockatrice, a cross-platform virtual tabletop for multiplayer card games
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
if: github.ref_type == 'tag'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ github.token }}
|
||||
|
||||
- name: Build and push Docker Image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.ref_type == 'tag' }}
|
||||
tags: ${{ steps.metadata.outputs.tags }}
|
||||
labels: ${{ steps.metadata.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
Reference in New Issue
Block a user