Merge pull request #83 from GameServerPanel/copilot/update-github-actions-workflows
This commit is contained in:
commit
f9f888ef41
2 changed files with 45 additions and 56 deletions
30
.github/workflows/create-release.yml
vendored
30
.github/workflows/create-release.yml
vendored
|
|
@ -24,29 +24,17 @@ jobs:
|
|||
|
||||
steps:
|
||||
# ──────────────────────────────────────────────
|
||||
# 1. Checkout the full repository history so we
|
||||
# can inspect branches and create tags.
|
||||
# 1. Checkout Panel-stable with full history so
|
||||
# we can inspect branches and create tags.
|
||||
# ──────────────────────────────────────────────
|
||||
- name: Checkout repository
|
||||
- name: Checkout Panel-stable
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: Panel-stable
|
||||
fetch-depth: 0
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 2. Safety: only allow releases from the
|
||||
# "stable" branch.
|
||||
# ──────────────────────────────────────────────
|
||||
- name: Verify we are on the stable branch
|
||||
run: |
|
||||
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
echo "Current branch: ${BRANCH}"
|
||||
if [ "${BRANCH}" != "stable" ]; then
|
||||
echo "::error::Releases must be created from the 'stable' branch. Current branch is '${BRANCH}'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 3. Safety: abort if the tag already exists to
|
||||
# 2. Safety: abort if the tag already exists to
|
||||
# prevent accidental overwrites.
|
||||
# ──────────────────────────────────────────────
|
||||
- name: Check that tag does not already exist
|
||||
|
|
@ -60,8 +48,8 @@ jobs:
|
|||
echo "Tag '${VERSION}' does not exist yet — safe to proceed."
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 4. Create the annotated git tag locally and
|
||||
# push it to origin.
|
||||
# 3. Create the annotated git tag on Panel-stable
|
||||
# and push it to origin.
|
||||
# ──────────────────────────────────────────────
|
||||
- name: Create and push git tag
|
||||
run: |
|
||||
|
|
@ -73,7 +61,7 @@ jobs:
|
|||
echo "Tag '${VERSION}' pushed to origin."
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 5. Build the release ZIP, excluding files that
|
||||
# 4. Build the release ZIP, excluding files that
|
||||
# should never ship (secrets, dev artifacts,
|
||||
# version-control metadata, etc.).
|
||||
# ──────────────────────────────────────────────
|
||||
|
|
@ -102,7 +90,7 @@ jobs:
|
|||
ls -lh "${ARCHIVE}"
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# 6. Create the GitHub Release and upload the
|
||||
# 5. Create the GitHub Release and upload the
|
||||
# ZIP asset. Uses only the built-in
|
||||
# GITHUB_TOKEN — no personal token needed.
|
||||
# ──────────────────────────────────────────────
|
||||
|
|
|
|||
71
.github/workflows/promote-unstable-to-stable.yml
vendored
71
.github/workflows/promote-unstable-to-stable.yml
vendored
|
|
@ -1,15 +1,15 @@
|
|||
name: Promote Unstable to Stable
|
||||
|
||||
# This workflow is MANUAL-ONLY.
|
||||
# It overwrites the stable branch with the exact contents of unstable.
|
||||
# No merge is performed — stable becomes identical to unstable (force push).
|
||||
# It overwrites Panel-stable with the exact contents of Panel-unstable.
|
||||
# No merge is performed — Panel-stable becomes identical to Panel-unstable (force push).
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
promote:
|
||||
name: Overwrite stable with unstable
|
||||
name: Overwrite Panel-stable with Panel-unstable
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
|
|
@ -21,67 +21,68 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0 # Full history so all branches are available
|
||||
|
||||
- name: Fetch both branches
|
||||
- name: Fetch Panel-unstable and Panel-stable
|
||||
run: |
|
||||
git fetch origin unstable stable
|
||||
git fetch origin Panel-unstable Panel-stable
|
||||
|
||||
- name: Verify unstable branch exists
|
||||
- name: Verify Panel-unstable branch exists
|
||||
run: |
|
||||
if ! git rev-parse --verify origin/unstable > /dev/null 2>&1; then
|
||||
echo "ERROR: Branch 'unstable' does not exist on origin. Aborting."
|
||||
if ! git rev-parse --verify origin/Panel-unstable > /dev/null 2>&1; then
|
||||
echo "ERROR: Branch 'Panel-unstable' does not exist on origin. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
echo "Branch 'unstable' confirmed."
|
||||
echo "Branch 'Panel-unstable' confirmed."
|
||||
|
||||
- name: Verify stable branch exists
|
||||
- name: Verify Panel-stable branch exists
|
||||
run: |
|
||||
if ! git rev-parse --verify origin/stable > /dev/null 2>&1; then
|
||||
echo "ERROR: Branch 'stable' does not exist on origin. Aborting."
|
||||
if ! git rev-parse --verify origin/Panel-stable > /dev/null 2>&1; then
|
||||
echo "ERROR: Branch 'Panel-stable' does not exist on origin. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
echo "Branch 'stable' confirmed."
|
||||
echo "Branch 'Panel-stable' confirmed."
|
||||
|
||||
- name: Show current commit hashes before update
|
||||
- name: Show commit hashes before update
|
||||
run: |
|
||||
UNSTABLE_COMMIT=$(git rev-parse origin/unstable)
|
||||
STABLE_COMMIT=$(git rev-parse origin/stable)
|
||||
echo "Current unstable commit : $UNSTABLE_COMMIT"
|
||||
echo "Current stable commit : $STABLE_COMMIT"
|
||||
UNSTABLE_COMMIT=$(git rev-parse origin/Panel-unstable)
|
||||
STABLE_COMMIT=$(git rev-parse origin/Panel-stable)
|
||||
echo "Panel-unstable commit : $UNSTABLE_COMMIT"
|
||||
echo "Panel-stable commit (before) : $STABLE_COMMIT"
|
||||
echo "UNSTABLE_COMMIT=$UNSTABLE_COMMIT" >> "$GITHUB_ENV"
|
||||
echo "STABLE_BEFORE=$STABLE_COMMIT" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Check out stable locally
|
||||
- name: Check out Panel-stable locally
|
||||
run: |
|
||||
git checkout stable
|
||||
git checkout -B Panel-stable origin/Panel-stable
|
||||
|
||||
- name: Reset stable to match unstable exactly
|
||||
# This is NOT a merge. We hard-reset stable to the same commit as unstable.
|
||||
# After this step, stable and unstable are byte-for-byte identical.
|
||||
- name: Reset Panel-stable to match Panel-unstable exactly
|
||||
# This is NOT a merge. We hard-reset Panel-stable to the same commit as Panel-unstable.
|
||||
# After this step, Panel-stable and Panel-unstable are byte-for-byte identical.
|
||||
run: |
|
||||
git reset --hard origin/unstable
|
||||
git reset --hard origin/Panel-unstable
|
||||
|
||||
- name: Force push stable to origin
|
||||
# --force is intentional: we are deliberately replacing stable with unstable.
|
||||
- name: Force push Panel-stable to origin
|
||||
# --force is intentional: we are deliberately replacing Panel-stable with Panel-unstable.
|
||||
# GITHUB_TOKEN is sufficient for repositories where the actor has write access.
|
||||
run: |
|
||||
git push origin stable --force
|
||||
git push origin Panel-stable --force
|
||||
|
||||
- name: Show stable commit after update
|
||||
- name: Show Panel-stable commit after update
|
||||
run: |
|
||||
git fetch origin stable
|
||||
STABLE_AFTER=$(git rev-parse origin/stable)
|
||||
git fetch origin Panel-stable
|
||||
STABLE_AFTER=$(git rev-parse origin/Panel-stable)
|
||||
echo "-------------------------------------------"
|
||||
echo "Promotion summary"
|
||||
echo "-------------------------------------------"
|
||||
echo "unstable commit : $UNSTABLE_COMMIT"
|
||||
echo "stable commit (before) : $STABLE_BEFORE"
|
||||
echo "stable commit (after) : $STABLE_AFTER"
|
||||
echo "Panel-unstable commit : $UNSTABLE_COMMIT"
|
||||
echo "Panel-stable commit (before) : $STABLE_BEFORE"
|
||||
echo "Panel-stable commit (after) : $STABLE_AFTER"
|
||||
echo "-------------------------------------------"
|
||||
if [ "$STABLE_AFTER" = "$UNSTABLE_COMMIT" ]; then
|
||||
echo "SUCCESS: stable now matches unstable."
|
||||
echo "SUCCESS: Panel-stable now matches Panel-unstable."
|
||||
else
|
||||
echo "WARNING: stable commit does not match expected unstable commit."
|
||||
echo "WARNING: Panel-stable commit does not match expected Panel-unstable commit."
|
||||
exit 1
|
||||
fi
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue