Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

fix: close alternate release entry points [skip version]

Juan Denisbf8633b239ca
diff --git a/.github/workflows/main-promotion.yml b/.github/workflows/main-promotion.yml
index f95d013d..18152a56 100644
--- a/.github/workflows/main-promotion.yml
+++ b/.github/workflows/main-promotion.yml
@@ -3,7 +3,7 @@ name: Main Promotion
on:
pull_request:
branches: [main]
- types: [opened, synchronize, reopened, ready_for_review]
+ types: [opened, synchronize, reopened, ready_for_review, edited]
permissions:
contents: read
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 1317a7a5..c158dccc 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -4,18 +4,6 @@ on:
push:
branches:
- main
- tags:
- - 'v*'
- workflow_dispatch:
- inputs:
- version:
- description: 'Version to release (e.g., 1.6.24)'
- required: true
- type: string
- prerelease:
- description: 'Mark as pre-release'
- type: boolean
- default: false
concurrency:
group: release-${{ github.ref }}
@@ -37,11 +25,6 @@ jobs:
uses: actions/github-script@v9
with:
script: |
- if (context.eventName !== 'push' || context.ref !== 'refs/heads/main') {
- core.info('Manual and tag-triggered releases do not use the branch promotion gate.');
- return;
- }
-
const { owner, repo } = context.repo;
const { data: pulls } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
owner,
@@ -85,20 +68,13 @@ jobs:
- name: Get version
id: version
run: |
- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
- VERSION="${{ github.event.inputs.version }}"
- elif [ "${{ github.event_name }}" = "push" ] && [ "${{ github.ref_type }}" = "tag" ]; then
- VERSION="${GITHUB_REF#refs/tags/v}"
- else
- VERSION=$(cat VERSION | tr -d '[:space:]')
- fi
+ VERSION=$(tr -d '[:space:]' < VERSION)
TAG="v$VERSION"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "Releasing ServerKit version: $VERSION"
- name: Require an unused release version
- if: github.event_name != 'push' || github.ref_type != 'tag'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ steps.version.outputs.tag }}
@@ -113,7 +89,6 @@ jobs:
fi
- name: Create and push tag
- if: github.event_name == 'push' && github.ref_type != 'tag'
run: |
TAG="${{ steps.version.outputs.tag }}"
git config user.name "github-actions[bot]"
@@ -264,7 +239,7 @@ jobs:
tag_name: ${{ needs.version.outputs.tag }}
name: ServerKit ${{ needs.version.outputs.tag }}
draft: false
- prerelease: ${{ github.event.inputs.prerelease == 'true' }}
+ prerelease: false
overwrite_files: false
files: |
release/*
diff --git a/scripts/test/test_release_workflow.sh b/scripts/test/test_release_workflow.sh
index f3815ea1..870b9fd5 100644
--- a/scripts/test/test_release_workflow.sh
+++ b/scripts/test/test_release_workflow.sh
@@ -20,8 +20,22 @@ expect_text() {
fi
}
+expect_absent() {
+ file="$1"
+ text="$2"
+ label="$3"
+ if grep -Fq -- "$text" "$file"; then
+ printf 'FAIL %s\n' "$label" >&2
+ failures=$((failures + 1))
+ else
+ printf 'ok %s\n' "$label"
+ fi
+}
+
expect_text "$PROMOTION" 'branches: [main]' \
'main promotion runs on pull requests targeting main'
+expect_text "$PROMOTION" 'ready_for_review, edited]' \
+ 'main promotion reruns when a pull request is retargeted'
expect_text "$PROMOTION" 'HEAD_BRANCH: ${{ github.head_ref }}' \
'main promotion reads the pull request head branch safely'
expect_text "$PROMOTION" '[ "$HEAD_BRANCH" != "dev" ]' \
@@ -31,6 +45,10 @@ expect_text "$PROMOTION" '[ "$HEAD_REPOSITORY" != "$REPOSITORY" ]' \
expect_text "$RELEASE" 'name: Verify dev promotion' \
'release verifies the merged promotion'
+expect_absent "$RELEASE" 'workflow_dispatch:' \
+ 'manual dispatch cannot bypass the dev promotion path'
+expect_absent "$RELEASE" " - 'v*'" \
+ 'tag pushes cannot bypass the dev promotion path'
expect_text "$RELEASE" 'listPullRequestsAssociatedWithCommit' \
'release resolves the pull request associated with the main commit'
expect_text "$RELEASE" "pull.head.ref === 'dev'" \