Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(workflow): add release test workflow for Docker images #1174

Merged
merged 3 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/release-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: release test

on:
push:
branches:
- main
pull_request:
paths:
- .github/workflows/release-test.yml
- .goreleaser.yml

jobs:
dockerimage-slim:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get latest version
id: latest_version
run: |
echo -n 'version=' > $GITHUB_OUTPUT
gh release list --limit 1 | cut -f 1 >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build (slim)
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.slim
platforms: linux/amd64,linux/arm64
push: false
tags: |
ghcr.io/k1low/runn:${{ steps.latest_version.outputs.version }}-slim
ghcr.io/k1low/runn:latest-slim
labels: |
org.opencontainers.image.name=runn
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ steps.latest_version.outputs.version }}
org.opencontainers.image.source=https://github.com/k1LoW/runn

dockerimage:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get latest version
id: latest_version
run: |
echo -n 'version=' > $GITHUB_OUTPUT
gh release list --limit 1 | cut -f 1 >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: false
tags: |
ghcr.io/k1low/runn:${{ steps.latest_version.outputs.version }}
ghcr.io/k1low/runn:latest
labels: |
org.opencontainers.image.name=runn
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ steps.latest_version.outputs.version }}
org.opencontainers.image.source=https://github.com/k1LoW/runn
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1-bullseye AS builder
FROM golang:1-bookworm AS builder

WORKDIR /workdir/
COPY . /workdir/
Expand All @@ -9,7 +9,7 @@ RUN update-ca-certificates

RUN make build

FROM debian:bullseye-slim
FROM debian:bookworm-slim

RUN apt-get update \
&& apt-get install -y fonts-noto-cjk \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.slim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1-bullseye AS builder
FROM golang:1-bookworm AS builder

WORKDIR /workdir/
COPY . /workdir/
Expand All @@ -9,7 +9,7 @@ RUN update-ca-certificates

RUN make build

FROM debian:bullseye-slim
FROM debian:bookworm-slim

COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /workdir/runn ./usr/bin
Expand Down
Loading