CJVT updates August and September 2026
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
# Builds the three custom images on every push to the default branch, pushes them to the
|
||||
# Gitea container registry tagged sha-<short>, then deploys that build to STAGING.
|
||||
#
|
||||
# Prerequisites (see README "Automated deployment"):
|
||||
# - a repo-scoped Gitea Runner (gitea/runner) with the `self-hosted` label
|
||||
# - the Gitea container registry enabled
|
||||
# - REGISTRY_TOKEN secret: a PAT with write:package scope (the automatic GITEA_TOKEN is
|
||||
# NOT authorized to push packages on this instance)
|
||||
# - staging secrets: STAGING_SSH_HOST, STAGING_SSH_USER, STAGING_SSH_KEY, and optionally
|
||||
# STAGING_SSH_PORT if the host's sshd doesn't listen on the default port 22
|
||||
# (the deploy user's forced-command wrapper on the host owns the checkout path)
|
||||
name: build-and-stage
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: [self-hosted]
|
||||
outputs:
|
||||
registry: ${{ steps.meta.outputs.registry }}
|
||||
tag: ${{ steps.meta.outputs.tag }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Compute registry + tag
|
||||
id: meta
|
||||
run: |
|
||||
host="$(echo "${{ github.server_url }}" | sed -E 's#^https?://##')"
|
||||
owner="${{ github.repository_owner }}"
|
||||
echo "host=$host" >>"$GITHUB_OUTPUT"
|
||||
# OCI repository paths must be lowercase; Gitea maps the lowercased owner back.
|
||||
echo "registry=$host/${owner,,}" >>"$GITHUB_OUTPUT"
|
||||
echo "tag=sha-$(git rev-parse --short HEAD)" >>"$GITHUB_OUTPUT"
|
||||
|
||||
- name: Registry login
|
||||
run: |
|
||||
echo "${{ secrets.REGISTRY_TOKEN }}" \
|
||||
| docker login "${{ steps.meta.outputs.host }}" -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
- name: Set up buildx (registry cache needs the docker-container driver)
|
||||
run: docker buildx use ci 2>/dev/null || docker buildx create --name ci --driver docker-container --use
|
||||
|
||||
- name: Build & push images
|
||||
env:
|
||||
REGISTRY: ${{ steps.meta.outputs.registry }}
|
||||
TAG: ${{ steps.meta.outputs.tag }}
|
||||
run: bash dev/ci/build.sh
|
||||
|
||||
deploy-staging:
|
||||
needs: build
|
||||
runs-on: [self-hosted]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Deploy to staging
|
||||
env:
|
||||
DEPLOY_HOST: ${{ secrets.STAGING_SSH_HOST }}
|
||||
DEPLOY_USER: ${{ secrets.STAGING_SSH_USER }}
|
||||
DEPLOY_SSH_KEY: ${{ secrets.STAGING_SSH_KEY }}
|
||||
DEPLOY_SSH_PORT: ${{ secrets.STAGING_SSH_PORT }}
|
||||
IMAGE_TAG: ${{ needs.build.outputs.tag }}
|
||||
run: bash dev/ci/deploy.sh
|
||||
@@ -0,0 +1,32 @@
|
||||
# Manual deploy of an arbitrary existing image tag to a chosen environment.
|
||||
# Primary use: ROLLBACK (deploy a previous v* tag) and ad-hoc redeploys.
|
||||
#
|
||||
# The image_tag must already exist in the registry (e.g. v1.2.2 or sha-abc1234). deploy.sh
|
||||
# derives the git ref to check out from it (strips a leading "sha-").
|
||||
name: deploy-dispatch
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
environment:
|
||||
description: Target environment
|
||||
type: choice
|
||||
options: [staging, prod]
|
||||
required: true
|
||||
image_tag:
|
||||
description: Image tag to deploy, e.g. v1.2.2 or sha-abc1234
|
||||
type: string
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: [self-hosted]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Deploy ${{ inputs.image_tag }} to ${{ inputs.environment }}
|
||||
env:
|
||||
DEPLOY_HOST: ${{ inputs.environment == 'prod' && secrets.PROD_SSH_HOST || secrets.STAGING_SSH_HOST }}
|
||||
DEPLOY_USER: ${{ inputs.environment == 'prod' && secrets.PROD_SSH_USER || secrets.STAGING_SSH_USER }}
|
||||
DEPLOY_SSH_KEY: ${{ inputs.environment == 'prod' && secrets.PROD_SSH_KEY || secrets.STAGING_SSH_KEY }}
|
||||
IMAGE_TAG: ${{ inputs.image_tag }}
|
||||
run: bash dev/ci/deploy.sh
|
||||
@@ -0,0 +1,54 @@
|
||||
# Production release. Triggered by pushing a version tag (v*). Pushing the tag IS the
|
||||
# deliberate human gate. It promotes the images already built for that commit on the default
|
||||
# branch (no rebuild) to the version tag, then deploys them to PRODUCTION.
|
||||
#
|
||||
# The tagged commit must already have been built on the default branch (build-and-stage),
|
||||
# so its sha-<short> images exist; otherwise promotion fails with a clear error.
|
||||
#
|
||||
# Prerequisites: REGISTRY_TOKEN secret (PAT with write:package; the automatic GITEA_TOKEN is
|
||||
# not authorized to push packages), plus prod secrets PROD_SSH_HOST, PROD_SSH_USER, PROD_SSH_KEY
|
||||
# (the deploy user's forced-command wrapper on the host owns the checkout path), and optionally
|
||||
# PROD_SSH_PORT if the host's sshd doesn't listen on the default port 22.
|
||||
name: release-prod
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["v*"]
|
||||
|
||||
jobs:
|
||||
promote-and-deploy:
|
||||
runs-on: [self-hosted]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Compute registry + tags
|
||||
id: meta
|
||||
run: |
|
||||
host="$(echo "${{ github.server_url }}" | sed -E 's#^https?://##')"
|
||||
owner="${{ github.repository_owner }}"
|
||||
echo "host=$host" >>"$GITHUB_OUTPUT"
|
||||
# OCI repository paths must be lowercase; Gitea maps the lowercased owner back.
|
||||
echo "registry=$host/${owner,,}" >>"$GITHUB_OUTPUT"
|
||||
echo "src_tag=sha-$(git rev-parse --short HEAD)" >>"$GITHUB_OUTPUT"
|
||||
echo "dst_tag=${{ github.ref_name }}" >>"$GITHUB_OUTPUT"
|
||||
|
||||
- name: Registry login
|
||||
run: |
|
||||
echo "${{ secrets.REGISTRY_TOKEN }}" \
|
||||
| docker login "${{ steps.meta.outputs.host }}" -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
- name: Promote images (no rebuild)
|
||||
env:
|
||||
REGISTRY: ${{ steps.meta.outputs.registry }}
|
||||
SRC_TAG: ${{ steps.meta.outputs.src_tag }}
|
||||
DST_TAG: ${{ steps.meta.outputs.dst_tag }}
|
||||
run: bash dev/ci/promote.sh
|
||||
|
||||
- name: Deploy to production
|
||||
env:
|
||||
DEPLOY_HOST: ${{ secrets.PROD_SSH_HOST }}
|
||||
DEPLOY_USER: ${{ secrets.PROD_SSH_USER }}
|
||||
DEPLOY_SSH_KEY: ${{ secrets.PROD_SSH_KEY }}
|
||||
DEPLOY_SSH_PORT: ${{ secrets.PROD_SSH_PORT }}
|
||||
IMAGE_TAG: ${{ steps.meta.outputs.dst_tag }}
|
||||
run: bash dev/ci/deploy.sh
|
||||
Reference in New Issue
Block a user