Files
Kiroku/.github/workflows/docker-publish.yaml
T

74 lines
2.3 KiB
YAML

name: Docker Build and Publish
on:
push:
branches:
- '*'
tags:
- '*.*.*'
pull_request:
env:
IMAGE_NAME: ghcr.io/yuzuzensai/kiroku
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Lint, format, and typecheck
run: bun run check
- name: Test
run: bun test
docker:
needs: check
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: docker-meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest-dev,enable=${{ github.ref_type == 'branch' }}
type=raw,value=${{ github.ref_name }},enable=${{ github.ref_type == 'branch' }}
type=raw,value=${{ github.sha }},enable=${{ github.ref_type == 'branch' }}
flavor: |
latest=${{ github.ref_type == 'tag' && !contains(github.ref_name, '-') }}
- name: Docker Build and Push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}