Skip to content

Commit e8b7077

Browse files
committed
Move to common seabird-chat CI tooling
1 parent 1b01ad4 commit e8b7077

2 files changed

Lines changed: 11 additions & 123 deletions

File tree

.github/workflows/docker-pr.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Docker Build
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
7+
jobs:
8+
build:
9+
uses: seabird-chat/ci/.github/workflows/docker-pr.yml@main
Lines changed: 2 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,10 @@
1-
name: Docker
1+
name: Docker Publish
22

33
on:
44
push:
55
branches: [ "main" ]
66
tags: [ 'v*.*.*' ]
7-
pull_request:
8-
branches: [ "main" ]
9-
10-
env:
11-
REGISTRY: ghcr.io
12-
IMAGE_NAME: ${{ github.repository }}
137

148
jobs:
159
build:
16-
runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-latest' || matrix.platform == 'linux/arm64' && 'ubuntu-24.04-arm' }}
17-
strategy:
18-
matrix:
19-
platform:
20-
- linux/amd64
21-
- linux/arm64
22-
23-
permissions:
24-
contents: read
25-
packages: write
26-
27-
steps:
28-
- name: Checkout repository
29-
uses: actions/checkout@v3
30-
with:
31-
submodules: true
32-
33-
- name: Prepare environment
34-
run: |
35-
platform=${{ matrix.platform }}
36-
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
37-
38-
- name: Log into registry ${{ env.REGISTRY }}
39-
if: github.event_name != 'pull_request'
40-
uses: docker/login-action@v2
41-
with:
42-
registry: ${{ env.REGISTRY }}
43-
username: ${{ github.actor }}
44-
password: ${{ secrets.GITHUB_TOKEN }}
45-
46-
- name: Set up QEMU
47-
uses: docker/setup-qemu-action@v3
48-
49-
- name: Setup Docker buildx
50-
uses: docker/setup-buildx-action@v3
51-
52-
- name: Extract Docker metadata
53-
id: meta
54-
uses: docker/metadata-action@v5
55-
with:
56-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
57-
58-
- name: Build and push digest
59-
id: build
60-
uses: docker/build-push-action@v6
61-
with:
62-
context: .
63-
platforms: ${{ matrix.platform }}
64-
push: ${{ github.event_name != 'pull_request' }}
65-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
66-
labels: ${{ steps.meta.outputs.labels }}
67-
cache-from: type=gha
68-
cache-to: type=gha,mode=max
69-
outputs: type=image,push-by-digest=true,name-canonical=true
70-
71-
- name: Export digest
72-
if: github.event_name != 'pull_request'
73-
run: |
74-
mkdir -p ${{ runner.temp }}/digests
75-
digest="${{ steps.build.outputs.digest }}"
76-
touch "${{ runner.temp }}/digests/${digest#sha256:}"
77-
78-
- name: Upload digest
79-
if: github.event_name != 'pull_request'
80-
uses: actions/upload-artifact@v4
81-
with:
82-
name: digests-${{ env.PLATFORM_PAIR }}
83-
path: ${{ runner.temp }}/digests/*
84-
if-no-files-found: error
85-
retention-days: 1
86-
87-
release:
88-
runs-on: ubuntu-latest
89-
if: github.event_name != 'pull_request'
90-
needs:
91-
- build
92-
steps:
93-
- name: Download digests
94-
uses: actions/download-artifact@v4
95-
with:
96-
path: ${{ runner.temp }}/digests
97-
pattern: digests-*
98-
merge-multiple: true
99-
100-
- name: Log into registry ${{ env.REGISTRY }}
101-
uses: docker/login-action@v2
102-
with:
103-
registry: ${{ env.REGISTRY }}
104-
username: ${{ github.actor }}
105-
password: ${{ secrets.GITHUB_TOKEN }}
106-
107-
- name: Set up Docker Buildx
108-
uses: docker/setup-buildx-action@v3
109-
110-
- name: Docker meta
111-
id: meta
112-
uses: docker/metadata-action@v5
113-
with:
114-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
115-
# This will result in the latest tagged version being released as
116-
# vX.Y.Z, vX.Y, and latest. The most recent commit on main will also
117-
# be tagged as edge.
118-
tags: |
119-
type=edge,branch=main
120-
type=semver,pattern={{version}}
121-
type=semver,pattern={{major}}.{{minor}}
122-
123-
- name: Create manifest list and push
124-
working-directory: ${{ runner.temp }}/digests
125-
run: |
126-
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
127-
$(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
128-
129-
- name: Inspect image
130-
run: |
131-
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
10+
uses: seabird-chat/ci/.github/workflows/docker-publish.yml@main

0 commit comments

Comments
 (0)