-
Notifications
You must be signed in to change notification settings - Fork 4
108 lines (96 loc) · 3.48 KB
/
Copy pathpaperclip-image.yaml
File metadata and controls
108 lines (96 loc) · 3.48 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
name: Paperclip Image
on:
# Poll upstream for new releases (runs daily)
schedule:
- cron: '0 6 * * *'
# Manual trigger with optional version override
workflow_dispatch:
inputs:
version:
description: 'Upstream version to build (e.g. v2026.318.0). Leave empty to build latest release.'
required: false
type: string
env:
REGISTRY: ghcr.io
UPSTREAM_REPO: paperclipai/paperclip
IMAGE_NAME: paperclip
jobs:
check:
name: Check for new release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.resolve.outputs.version }}
should_build: ${{ steps.resolve.outputs.should_build }}
steps:
- name: Resolve version to build
id: resolve
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
else
VERSION=$(gh api repos/${{ env.UPSTREAM_REPO }}/releases/latest --jq '.tag_name')
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
OWNER="${GITHUB_REPOSITORY_OWNER,,}"
# Check if this version is already published
if docker buildx imagetools inspect ${{ env.REGISTRY }}/${OWNER}/${{ env.IMAGE_NAME }}:${VERSION} >/dev/null 2>&1; then
echo "Image ${{ env.REGISTRY }}/${OWNER}/${{ env.IMAGE_NAME }}:${VERSION} already exists, skipping"
echo "should_build=false" >> $GITHUB_OUTPUT
else
echo "should_build=true" >> $GITHUB_OUTPUT
fi
- name: Set up Docker Buildx
if: steps.resolve.outputs.should_build == 'true'
uses: docker/setup-buildx-action@v3
- name: Login to GHCR (for imagetools inspect)
if: steps.resolve.outputs.should_build == 'true'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build & Push
needs: check
if: needs.check.outputs.should_build == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout upstream
uses: actions/checkout@v4
with:
repository: ${{ env.UPSTREAM_REPO }}
ref: ${{ needs.check.outputs.version }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compute image tags
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ needs.check.outputs.version }}
type=raw,value=latest
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: |
org.opencontainers.image.source=https://github.com/${{ env.UPSTREAM_REPO }}
org.opencontainers.image.version=${{ needs.check.outputs.version }}
org.opencontainers.image.description=Paperclip - AI agent orchestration platform
cache-from: type=gha,scope=paperclip-image
cache-to: type=gha,mode=max,scope=paperclip-image