Skip to content

Made SQLite-backed storage impls use journal_mode = WAL, busy_timeout… #17

Made SQLite-backed storage impls use journal_mode = WAL, busy_timeout…

Made SQLite-backed storage impls use journal_mode = WAL, busy_timeout… #17

name: Release service Docker image (GHCR)
on:
push:
tags:
- "did-webplus-cli-v*"
- "did-webplus-urd-v*"
- "did-webplus-vdg-v*"
- "did-webplus-vdr-v*"
permissions:
contents: read
packages: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout (full history; we need to test ancestry vs main)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Validate tag format and derive service/version
id: tag
env:
REPO_OWNER: ${{ github.repository_owner }}
shell: bash
run: |
set -euo pipefail
TAG="${GITHUB_REF_NAME}" # e.g. did-webplus-vdr-v1.2.3 or did-webplus-vdr-v1.2.4-rc.3
# GHCR requires lowercase repository names
REPO_OWNER_LC=$(echo "$REPO_OWNER" | tr '[:upper:]' '[:lower:]')
# Disallow SemVer build metadata because Docker tags disallow '+'
if [[ "$TAG" == *"+"* ]]; then
echo "ERROR: tag contains '+', which is not allowed for Docker tags: $TAG"
exit 1
fi
# Accept:
# did-webplus-(cli|urd|vdg|vdr)-vMAJOR.MINOR.PATCH
# did-webplus-(cli|urd|vdg|vdr)-vMAJOR.MINOR.PATCH-<pre-release>
#
# Examples allowed:
# did-webplus-vdr-v1.2.3
# did-webplus-vdr-v1.2.4-rc.3
#
# Examples rejected:
# did-webplus-vdr-v1.2
# did-webplus-vdr-v1.2.3+build.2
# did-webplus-vdr-v1.2.3+whatever
#
# Pre-release part is conservative: [0-9A-Za-z.-]+ (no '+')
if [[ "$TAG" =~ ^(did-webplus-(cli|urd|vdg|vdr))-v([0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?)$ ]]; then
SERVICE="${BASH_REMATCH[1]}" # did-webplus-vdr (full service image name)
SHORT="${BASH_REMATCH[2]}" # vdr / vdg / urd
VERSION="v${BASH_REMATCH[3]}" # v1.2.3 or v1.2.4-rc.3 (full version after 'v')
else
echo "ERROR: tag does not match required pattern: $TAG"
echo "Expected: did-webplus-(cli|urd|vdg|vdr)-vMAJOR.MINOR.PATCH[-prerelease]"
exit 1
fi
# Map service -> Dockerfile path (relative to repo root)
DOCKERFILE="did-webplus/${SHORT}/Dockerfile"
echo "service=$SERVICE" >> "$GITHUB_OUTPUT"
echo "short=$SHORT" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "dockerfile=$DOCKERFILE" >> "$GITHUB_OUTPUT"
echo "repository_owner_lc=$REPO_OWNER_LC" >> "$GITHUB_OUTPUT"
echo "Derived:"
echo " SERVICE=$SERVICE"
echo " VERSION=$VERSION"
echo " DOCKERFILE=$DOCKERFILE"
- name: Ensure tag commit is on main
shell: bash
run: |
set -euo pipefail
git fetch --no-tags origin main:refs/remotes/origin/main
TAG_SHA="${GITHUB_SHA}"
if git merge-base --is-ancestor "$TAG_SHA" "refs/remotes/origin/main"; then
echo "OK: tag commit ${TAG_SHA} is contained in origin/main"
else
echo "ERROR: tag commit ${TAG_SHA} is NOT on origin/main; refusing to publish."
echo " Make sure the tag points to a commit reachable from main."
exit 1
fi
- 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 }}
# If you want multi-arch later, add docker/setup-qemu-action and platforms below.
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
file: ./${{ steps.tag.outputs.dockerfile }}
push: true
tags: |
ghcr.io/${{ steps.tag.outputs.repository_owner_lc }}/${{ steps.tag.outputs.service }}:${{ steps.tag.outputs.version }}
ghcr.io/${{ steps.tag.outputs.repository_owner_lc }}/${{ steps.tag.outputs.service }}:sha-${{ github.sha }}
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ steps.tag.outputs.version }}
# Optional: also push :latest for stable releases only (no prerelease hyphen)
- name: Push :latest (stable releases only)
if: ${{ !contains(steps.tag.outputs.version, '-') }}
shell: bash
run: |
set -euo pipefail
IMAGE="ghcr.io/${{ steps.tag.outputs.repository_owner_lc }}/${{ steps.tag.outputs.service }}"
docker buildx imagetools create \
-t "${IMAGE}:latest" \
"${IMAGE}:${{ steps.tag.outputs.version }}"
# slackNotification:
# name: Notify Slack
# needs: [release]
# runs-on: [shared]
# steps:
# - name: Slack Notification
# uses: rtCamp/action-slack-notify@v2
# env:
# SLACK_ICON_EMOJI: ':octocat:'
# SLACK_COLOR: ${{ job.status }}
# SLACK_TITLE: ghcr.io/${{ steps.tag.outputs.repository_owner_lc }}/${{ steps.tag.outputs.service }}:${{ steps.tag.outputs.version }} ${{ job.status == 'success' && 'succeeded' || 'failed' }}
# SLACK_MESSAGE: |
# Branch: ${{ github.head_ref || github.ref_name }}
# ${{ github.event.head_commit.message != '' && format('Commit: {0}', github.event.head_commit.message) || '' }}
# <https://github.com/${{ github.repository }}/commit/${{ github.sha }}|View Changes>
# SLACK_WEBHOOK: ${{ secrets.GH_ACTIONS_SLACK_WEBHOOK }}