feat(release): add emergency app rollback
This commit is contained in:
@@ -6,6 +6,11 @@ on:
|
||||
tag:
|
||||
description: "Release tag (e.g. v0.3.10)"
|
||||
required: true
|
||||
notify:
|
||||
description: "Send release notification"
|
||||
required: false
|
||||
default: true
|
||||
type: boolean
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -400,6 +405,7 @@ jobs:
|
||||
notify-qq:
|
||||
name: QQ Notify
|
||||
needs: [promote-release]
|
||||
if: ${{ inputs.notify }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build message
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
name: Rollback Docker Latest
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Published app release tag to promote as Docker latest"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
CNB_REPOSITORY: "dbxio.com/dbx"
|
||||
CNB_REGISTRY: "docker.cnb.cool"
|
||||
|
||||
jobs:
|
||||
rollback-docker-latest:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Validate version tag
|
||||
id: version
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
tag="${{ inputs.tag }}"
|
||||
if [[ ! "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "::error::Tag '$tag' must use stable vX.Y.Z format."
|
||||
exit 1
|
||||
fi
|
||||
echo "version=${tag#v}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Login to CNB Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.CNB_REGISTRY }}
|
||||
username: cnb
|
||||
password: ${{ secrets.CNB_TOKEN }}
|
||||
|
||||
- name: Point latest tags to rollback version
|
||||
env:
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
DOCKERHUB_REPOSITORY: ${{ secrets.DOCKERHUB_USERNAME }}/dbx
|
||||
CNB_IMAGE: ${{ env.CNB_REGISTRY }}/${{ env.CNB_REPOSITORY }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# Reuse immutable version manifests; an emergency rollback must not rebuild source.
|
||||
docker buildx imagetools inspect "${DOCKERHUB_REPOSITORY}:${VERSION}" >/dev/null
|
||||
docker buildx imagetools inspect "${CNB_IMAGE}:${VERSION}" >/dev/null
|
||||
docker buildx imagetools create -t "${DOCKERHUB_REPOSITORY}:latest" "${DOCKERHUB_REPOSITORY}:${VERSION}"
|
||||
docker buildx imagetools create -t "${CNB_IMAGE}:latest" "${CNB_IMAGE}:${VERSION}"
|
||||
Reference in New Issue
Block a user