Skip to content

Add graceful shutdown #25

Add graceful shutdown

Add graceful shutdown #25

Workflow file for this run

---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: read
pull-requests: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: stable
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.6
only-new-issues: true
build-and-push:
name: Build and Push Docker Image
runs-on: ubuntu-latest
needs: golangci
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Collect Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
flavor: latest=false
images: ghcr.io/${{ github.repository }}
tags: |
# Tag as 'latest' only on main branch
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
# Tag as 'pr-123' for PRs (useful for local testing, won't be pushed to registry)
type=ref,event=pr
# Tag with short SHA
type=sha
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# with:
# platforms: amd64 ,arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and publish Docker image
uses: docker/build-push-action@v6
with:
context: .
# Push only on main branch or tags, skip push on PRs
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64 # ,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-to: type=gha,mode=min
cache-from: type=gha