ci: add docker publish workflows

This commit is contained in:
2026-05-10 10:13:04 +09:00
parent 7885824f92
commit c32214e714
3 changed files with 154 additions and 0 deletions

57
.github/workflows/publish-branch.yml vendored Normal file
View File

@@ -0,0 +1,57 @@
name: publish-branch
on:
push:
branches:
- main
permissions:
contents: read
packages: write
concurrency:
group: publish-branch-${{ github.ref }}
cancel-in-progress: true
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/p-sw/codexdash
tags: |
type=raw,value=main
type=sha,prefix=sha-
- name: Build and push branch image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=publish-branch
cache-to: type=gha,mode=max,scope=publish-branch

60
.github/workflows/publish-release.yml vendored Normal file
View File

@@ -0,0 +1,60 @@
name: publish-release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: read
packages: write
concurrency:
group: publish-release-${{ github.ref }}
cancel-in-progress: true
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/p-sw/codexdash
tags: |
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest
- name: Build and push release image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=publish-release
cache-to: type=gha,mode=max,scope=publish-release

37
.github/workflows/verify.yml vendored Normal file
View File

@@ -0,0 +1,37 @@
name: verify
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
jobs:
verify:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.13
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run tests
run: bun run test
- name: Run lint
run: bun run lint
- name: Run build
run: bun run build
- name: Verify Docker build
run: docker build --tag codexdash:verify .