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.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
fix(ci): isolate dev release publication from PR builds [skip version]
Juan Denisb90931317ce7
diff --git a/.github/workflows/release-smoke.yml b/.github/workflows/release-smoke.ymlindex c2fe0df1..e8948ab1 100644--- a/.github/workflows/release-smoke.yml+++ b/.github/workflows/release-smoke.yml@@ -43,17 +43,20 @@ concurrency:group: release-smoke-${{ github.ref }}cancel-in-progress: true+permissions:+ contents: read+jobs:build-release-smoke:name: Build release tarballruns-on: ubuntu-latest- permissions:- contents: writeoutputs:dev_tag: ${{ steps.dev.outputs.tag }}steps:- name: Checkout codeuses: actions/checkout@v4+ with:+ persist-credentials: false# A dev build carries the commit in its version, so the lab records it# under a name that is unique, sorts after the release it is based on,@@ -84,13 +87,38 @@ jobs:BUILD_ARCH: amd64run: bash scripts/build-release.sh+ - name: Save the dev release files+ if: github.event_name == 'push'+ uses: actions/upload-artifact@v4+ with:+ name: dev-release+ path: |+ serverkit-*.tar.gz+ checksums.txt+ if-no-files-found: error+ retention-days: 1++ publish-dev:+ name: Publish dev pre-release+ if: github.event_name == 'push' && github.ref == 'refs/heads/dev'+ needs: build-release-smoke+ runs-on: ubuntu-latest+ permissions:+ contents: write+ steps:+ # No checkout or repository scripts run with the write token.+ - name: Download the built release files+ uses: actions/download-artifact@v4+ with:+ name: dev-release+- name: Publish the dev build as a pre-releaseif: github.event_name == 'push'uses: softprops/action-gh-release@v3with:- tag_name: ${{ steps.dev.outputs.tag }}+ tag_name: ${{ needs.build-release-smoke.outputs.dev_tag }}target_commitish: ${{ github.sha }}- name: Dev build ${{ steps.dev.outputs.tag }}+ name: Dev build ${{ needs.build-release-smoke.outputs.dev_tag }}prerelease: truedraft: falsefiles: |diff --git a/backend/tests/test_release_smoke_permissions.py b/backend/tests/test_release_smoke_permissions.pynew file mode 100644index 00000000..898ae82f--- /dev/null+++ b/backend/tests/test_release_smoke_permissions.py@@ -0,0 +1,25 @@+"""The release build must never run PR code with repository-write credentials."""+from pathlib import Path++import yaml+++def test_only_push_only_publication_has_write_permissions():+ path = Path(__file__).resolve().parents[2] / '.github/workflows/release-smoke.yml'+ workflow = yaml.safe_load(path.read_text(encoding='utf-8'))+ assert workflow['permissions'] == {'contents': 'read'}+ privileged_jobs = []+ for name, job in workflow['jobs'].items():+ permissions = job.get('permissions', workflow['permissions'])+ if permissions.get('contents') != 'write':+ continue+ privileged_jobs.append(name)+ assert job['if'] == "github.event_name == 'push' && github.ref == 'refs/heads/dev'"+ assert job['needs'] == 'build-release-smoke'+ assert not any('checkout@' in step.get('uses', '') for step in job['steps'])+ # The only shell step is inline cleanup; none executes repository code.+ for step in job['steps']:+ if 'run' in step:+ assert 'gh release list' in step['run']+ assert 'scripts/' not in step['run']+ assert privileged_jobs == ['publish-dev']