-
Notifications
You must be signed in to change notification settings - Fork 4
99 lines (87 loc) · 2.77 KB
/
Copy pathcd-web.yml
File metadata and controls
99 lines (87 loc) · 2.77 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
name: CD - AgentHub Web
on:
push:
branches: [master]
paths:
- "app/web/**"
- "app/shared/**"
- "app/workbench/**"
- "app/package.json"
- "app/pnpm-lock.yaml"
- "app/pnpm-workspace.yaml"
- "app/Dockerfile"
- ".github/workflows/cd-web.yml"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
IMAGE_NAME: ghcr.io/tokendancelab/agenthub-web
jobs:
build:
name: Build (${{ matrix.suffix }})
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- platform: linux/amd64
suffix: amd64
runner: ubuntu-latest
- platform: linux/arm64
suffix: arm64
runner: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push (${{ matrix.platform }})
uses: docker/build-push-action@v7
with:
context: app/
file: app/Dockerfile
push: true
platforms: ${{ matrix.platform }}
tags: ${{ env.IMAGE_NAME }}:sha-${{ github.sha }}-${{ matrix.suffix }}
cache-from: type=gha,scope=web-${{ matrix.suffix }}
cache-to: type=gha,mode=max,scope=web-${{ matrix.suffix }}
merge:
name: Merge multi-arch manifest
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
packages: write
steps:
- name: Login to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
type=raw,value={{date 'YYYYMMDD'}},enable=${{ github.ref == 'refs/heads/master' }}
type=sha,prefix=,format=short
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Create multi-arch manifest and push
run: |
docker buildx imagetools create \
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
${{ env.IMAGE_NAME }}:sha-${{ github.sha }}-amd64 \
${{ env.IMAGE_NAME }}:sha-${{ github.sha }}-arm64