Skip to content

Commit b9f49ac

Browse files
committed
ci: auto-build GHCR image on push to remote-fix
1 parent 3e76239 commit b9f49ac

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: ghcr-remote-fix
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- remote-fix
8+
9+
env:
10+
IMAGE: ghcr.io/${{ github.repository_owner }}/cli-proxy-api-plus
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Refresh models catalog
23+
run: |
24+
git fetch --depth 1 https://github.com/router-for-me/models.git main
25+
git show FETCH_HEAD:models.json > internal/registry/models/models.json
26+
27+
- name: Set up QEMU
28+
uses: docker/setup-qemu-action@v3
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: Login to GHCR
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ghcr.io
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Lowercase image name
41+
run: echo "IMAGE=$(echo '${{ env.IMAGE }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
42+
43+
- name: Generate Build Metadata
44+
run: |
45+
echo "VERSION=remote-fix" >> $GITHUB_ENV
46+
echo "COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
47+
echo "BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_ENV
48+
49+
- name: Build and push (multi-arch)
50+
uses: docker/build-push-action@v6
51+
with:
52+
context: .
53+
platforms: linux/amd64,linux/arm64
54+
push: true
55+
build-args: |
56+
VERSION=${{ env.VERSION }}
57+
COMMIT=${{ env.COMMIT }}
58+
BUILD_DATE=${{ env.BUILD_DATE }}
59+
tags: |
60+
${{ env.IMAGE }}:remote-fix
61+
${{ env.IMAGE }}:remote-fix-${{ env.COMMIT }}
62+
cache-from: type=gha
63+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)