-
Notifications
You must be signed in to change notification settings - Fork 1
118 lines (108 loc) · 3.55 KB
/
Copy pathdocker-go-sdk-examples.yml
File metadata and controls
118 lines (108 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Build and Push SDK Example Images
on:
push:
branches: [main]
paths:
- ".github/workflows/docker-go-sdk-examples.yml"
- "sdks/go/**"
- "sdks/python/**"
- "sdks/java/**"
- "sdks/js/**"
- "sdks/cpp/**"
- "sdks/csharp/**"
- "proto/**"
workflow_dispatch:
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
REGISTRY: ghcr.io
permissions:
contents: read
packages: write
jobs:
build-and-push:
name: Build ${{ matrix.language }} game demo image
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- language: go
image: ghcr.io/cuihairu/croupier-sdk-go-example-demo
context: sdks/go
dockerfile: sdks/go/examples/Dockerfile
build_args: |
EXAMPLE_DIR=demo
- language: python
image: ghcr.io/cuihairu/croupier-sdk-python-example-demo
context: .
dockerfile: sdks/python/examples/Dockerfile
build_args: ""
- language: java
image: ghcr.io/cuihairu/croupier-sdk-java-example-demo
context: .
dockerfile: sdks/java/examples/Dockerfile
build_args: ""
- language: js
image: ghcr.io/cuihairu/croupier-sdk-js-example-demo
context: .
dockerfile: sdks/js/examples/Dockerfile
build_args: ""
- language: cpp
image: ghcr.io/cuihairu/croupier-sdk-cpp-example-demo
context: .
dockerfile: sdks/cpp/examples/Dockerfile
build_args: ""
- language: csharp
image: ghcr.io/cuihairu/croupier-sdk-csharp-example-demo
context: .
dockerfile: sdks/csharp/examples/Dockerfile
build_args: ""
steps:
- name: Checkout repository
timeout-minutes: 3
uses: actions/checkout@v7
- name: Set up Docker Buildx
timeout-minutes: 5
uses: docker/setup-buildx-action@v4
- name: Log in to Container Registry
timeout-minutes: 3
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
timeout-minutes: 3
uses: docker/metadata-action@v6
with:
images: ${{ matrix.image }}
tags: |
type=ref,event=branch
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build JS SDK bundle
if: matrix.language == 'js'
working-directory: sdks/js
run: |
corepack enable
pnpm install --ignore-scripts
pnpm rebuild esbuild
pnpm build:bundle
- name: Prepare JS SDK Docker context
if: matrix.language == 'js'
run: cp sdks/js/dist/examples/game_demo.js sdks/js/examples/game_demo.js
- name: Build and push Docker image
timeout-minutes: 45
uses: docker/build-push-action@v7
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
build-args: ${{ matrix.build_args }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=sdk-demo-${{ matrix.language }}
cache-to: type=gha,mode=max,scope=sdk-demo-${{ matrix.language }}
provenance: false