-
-
Notifications
You must be signed in to change notification settings - Fork 177
139 lines (122 loc) · 6.14 KB
/
build-pr-images.yml
File metadata and controls
139 lines (122 loc) · 6.14 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Build PR Images
on:
pull_request_target:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
contents: read
packages: write
id-token: write
jobs:
build-pr-images:
# Only build if the PR is from a branch within the getarcaneapp organization
if: github.event.pull_request.head.repo.owner.login == 'getarcaneapp'
runs-on: depot-ubuntu-latest
env:
MANAGER_IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/arcane
AGENT_IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/arcane-headless
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Set up Depot CLI
uses: depot/setup-action@v1
- name: Setup Just
uses: extractions/setup-just@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Manager image metadata
id: manager-meta
uses: docker/metadata-action@v6
with:
images: ${{ env.MANAGER_IMAGE_NAME }}
tags: |
type=raw,value=pr-${{ github.event.pull_request.number }}
labels: |
org.opencontainers.image.authors=OFKM Technologies
org.opencontainers.image.url=https://github.com/getarcaneapp/arcane
org.opencontainers.image.documentation=https://github.com/getarcaneapp/arcane/blob/main/README.md
org.opencontainers.image.source=https://github.com/getarcaneapp/arcane
org.opencontainers.image.version=pr-${{ github.event.pull_request.number }}
org.opencontainers.image.revision=${{ github.event.pull_request.head.sha }}
org.opencontainers.image.licenses=BSD-3-Clause
org.opencontainers.image.ref.name=arcane
org.opencontainers.image.title=Arcane
org.opencontainers.image.description=Modern Docker Management, Made for Everyone
com.getarcaneapp.arcane=true
- name: Agent image metadata
id: agent-meta
uses: docker/metadata-action@v6
with:
images: ${{ env.AGENT_IMAGE_NAME }}
tags: |
type=raw,value=pr-${{ github.event.pull_request.number }}
labels: |
org.opencontainers.image.authors=OFKM Technologies
org.opencontainers.image.url=https://github.com/getarcaneapp/arcane
org.opencontainers.image.documentation=https://github.com/getarcaneapp/arcane/blob/main/README.md
org.opencontainers.image.source=https://github.com/getarcaneapp/arcane
org.opencontainers.image.version=pr-${{ github.event.pull_request.number }}
org.opencontainers.image.revision=${{ github.event.pull_request.head.sha }}
org.opencontainers.image.licenses=BSD-3-Clause
org.opencontainers.image.ref.name=arcane-agent
org.opencontainers.image.title=Arcane Agent
org.opencontainers.image.description=Arcane Agent
com.getarcaneapp.arcane=true
com.getarcaneapp.arcane.agent=true
- name: Build and push manager image
uses: depot/build-push-action@v1
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.manager-meta.outputs.tags }}
labels: ${{ steps.manager-meta.outputs.labels }}
build-args: |
VERSION=pr-${{ github.event.pull_request.number }}
REVISION=${{ github.event.pull_request.head.sha }}
sbom: true
provenance: true
- name: Build and push agent image
uses: depot/build-push-action@v1
with:
context: .
file: docker/Dockerfile-agent
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.agent-meta.outputs.tags }}
labels: ${{ steps.agent-meta.outputs.labels }}
build-args: |
VERSION=pr-${{ github.event.pull_request.number }}
REVISION=${{ github.event.pull_request.head.sha }}
sbom: true
provenance: true
- name: Find Comment
uses: peter-evans/find-comment@v4
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "getarcaneappbot"
body-includes: Container images for this PR have been built successfully!
- name: Comment PR Images
uses: peter-evans/create-or-update-comment@v5
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
token: ${{ secrets.ARCANE_BOT_TOKEN }}
body: |
Container images for this PR have been built successfully!
- **Manager**: `${{ env.MANAGER_IMAGE_NAME }}:pr-${{ github.event.pull_request.number }}`
- **Agent**: `${{ env.AGENT_IMAGE_NAME }}:pr-${{ github.event.pull_request.number }}`
Built from commit ${{ github.event.pull_request.head.sha }}
edit-mode: replace