mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-10-06 23:26:55 +01:00
Merge pull request #62 from Curabis/setup/promote-button
Promote-knappen: udrulning med ét klik (workflow_dispatch)
This commit is contained in:
commit
dcccc2865c
2 changed files with 69 additions and 1 deletions
53
.github/workflows/promote-stable.yml
vendored
Normal file
53
.github/workflows/promote-stable.yml
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
name: Promote to stable
|
||||||
|
|
||||||
|
# Udrulningsknappen: fast-forwarder stable-kanalen til main med eet klik
|
||||||
|
# (Actions -> Promote to stable -> Run workflow). Manuel og bevidst -
|
||||||
|
# merge til main er IKKE deploy; dette workflow ER deployet.
|
||||||
|
#
|
||||||
|
# Sikkerhed: kun brugere med write-adgang kan dispatche. Nægter at køre,
|
||||||
|
# hvis stable er divergeret fra main (aldrig force). Hvis stable-branchen
|
||||||
|
# beskyttes af et ruleset, skal GitHub Actions (eller dette workflow) på
|
||||||
|
# rulesettets bypass-liste, for at push'et kan gennemføres.
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
promote:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: main
|
||||||
|
|
||||||
|
- name: Fast-forward stable to main
|
||||||
|
run: |
|
||||||
|
git fetch origin stable
|
||||||
|
|
||||||
|
if ! git merge-base --is-ancestor origin/stable origin/main; then
|
||||||
|
echo "::error::stable er ikke en forfader til main - kanalen er divergeret. Promotion afbrudt; undersøg manuelt (aldrig force)."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
OLD=$(git rev-parse origin/stable)
|
||||||
|
NEW=$(git rev-parse origin/main)
|
||||||
|
|
||||||
|
if [ "$OLD" = "$NEW" ]; then
|
||||||
|
echo "## Intet at promovere" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
echo "stable står allerede på main ($(git rev-parse --short "$NEW"))." >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "## Promoveret: $(git rev-parse --short "$OLD") → $(git rev-parse --short "$NEW")"
|
||||||
|
echo ""
|
||||||
|
echo "Commits udrullet til alle maskiner:"
|
||||||
|
git log --format='- `%h` %s' "$OLD".."$NEW"
|
||||||
|
} >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
|
||||||
|
git push origin origin/main:stable
|
||||||
|
|
@ -68,7 +68,22 @@ fetch URLs, and the agent templates' knowledge references — read from the
|
||||||
**`stable`** branch, never from `main`. `main` is where PRs land and CI runs;
|
**`stable`** branch, never from `main`. `main` is where PRs land and CI runs;
|
||||||
`stable` is what every developer machine actually executes.
|
`stable` is what every developer machine actually executes.
|
||||||
|
|
||||||
Deploying is a deliberate act (Michael only):
|
Deploying is a deliberate act (Michael only). Three equivalent ways, safest
|
||||||
|
first:
|
||||||
|
|
||||||
|
**The button (works from any device):** GitHub → Actions → *Promote to
|
||||||
|
stable* → Run workflow. Refuses to run if the channel has diverged; writes a
|
||||||
|
summary of the promoted commits.
|
||||||
|
|
||||||
|
**The one-liner (from any up-to-date clone, touches no working tree):**
|
||||||
|
|
||||||
|
git fetch origin
|
||||||
|
git push origin origin/main:stable
|
||||||
|
|
||||||
|
Git itself refuses a non-fast-forward push — if it is rejected, someone has
|
||||||
|
committed directly to stable: that is a finding, never a reason to force.
|
||||||
|
|
||||||
|
**The explicit form (for understanding what a promote IS):**
|
||||||
|
|
||||||
git checkout stable
|
git checkout stable
|
||||||
git merge --ff-only main
|
git merge --ff-only main
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue