Skip to content

Commit b506bba

Browse files
authored
ci: release with docker image (#19)
1 parent 99be1c4 commit b506bba

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
target/
2+
.git/
3+
.github/
4+
.env
5+
*.md
6+
LICENSE
7+
Makefile
8+
scripts/

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,50 @@ jobs:
152152
run: |
153153
VERSION=${{ needs.prepare.outputs.version }}
154154
gh release upload "v${VERSION}" "${{ steps.package.outputs.archive }}" --clobber
155+
156+
docker:
157+
needs: [prepare, publish]
158+
if: needs.prepare.outputs.publish == 'true'
159+
runs-on: ubuntu-latest
160+
permissions:
161+
contents: read
162+
packages: write
163+
steps:
164+
- name: Checkout
165+
uses: actions/checkout@v4
166+
167+
- name: Download release artifacts
168+
env:
169+
GH_TOKEN: ${{ github.token }}
170+
run: |
171+
set -euo pipefail
172+
VERSION=${{ needs.prepare.outputs.version }}
173+
mkdir -p artifacts/amd64 artifacts/arm64
174+
gh release download "v${VERSION}" \
175+
--pattern "databend-loki-adapter-${VERSION}-x86_64-unknown-linux-musl.tar.gz" \
176+
--dir artifacts/amd64
177+
gh release download "v${VERSION}" \
178+
--pattern "databend-loki-adapter-${VERSION}-aarch64-unknown-linux-musl.tar.gz" \
179+
--dir artifacts/arm64
180+
tar -xzf artifacts/amd64/*.tar.gz -C artifacts/amd64
181+
tar -xzf artifacts/arm64/*.tar.gz -C artifacts/arm64
182+
183+
- name: Set up Docker Buildx
184+
uses: docker/setup-buildx-action@v3
185+
186+
- name: Login to GHCR
187+
uses: docker/login-action@v3
188+
with:
189+
registry: ghcr.io
190+
username: ${{ github.actor }}
191+
password: ${{ github.token }}
192+
193+
- name: Build and push
194+
uses: docker/build-push-action@v6
195+
with:
196+
context: .
197+
platforms: linux/amd64,linux/arm64
198+
push: true
199+
tags: |
200+
ghcr.io/${{ github.repository }}:${{ needs.prepare.outputs.version }}
201+
ghcr.io/${{ github.repository }}:latest

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM scratch
2+
ARG TARGETARCH
3+
COPY artifacts/${TARGETARCH}/databend-loki-adapter /databend-loki-adapter
4+
ENTRYPOINT ["/databend-loki-adapter"]

0 commit comments

Comments
 (0)