Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.
C++ 3d3d-sculptingcppdear-imguidigital-sculptingfbxgame-developmentgaussian-splattinggltfimage-to-3dmcpopenglopenusdsculptingtext-to-3dunreal-engine
Lock down the members' publishing path: insiders token only in environments, pinned actions, workflow check
islandmed112743f0a7a1
diff --git a/.github/workflows/insider-drop.yml b/.github/workflows/insider-drop.ymlindex 23c9416c..649a2060 100644--- a/.github/workflows/insider-drop.yml+++ b/.github/workflows/insider-drop.yml@@ -11,7 +11,9 @@# the drop is built, uploaded as the run's artifact drop-<date> for the coordinator to review and committed to the# insider repository marked held, but not posted or bundled. Run this workflow by hand with that date and# approve=true to release it: the committed drop (the one reviewed, not a new one) is posted and joins the bundle.-# Only this repository's own code runs; no pull request or issue input reaches it.+# Only this repository's own code runs; no pull request or issue input reaches it. INSIDERS_REPO_TOKEN lives only in+# the GitHub Environment "member-drops" (deployment: main only), so a run from any other branch can't read it; the+# token reaches the insider checkout and the push step only (never left in a git config the build could read).name: Insider dropon:@@ -40,6 +42,7 @@ jobs:drop:runs-on: ubuntu-24.04timeout-minutes: 60+ environment: member-dropsenv:HOLD_UNTIL: "2026-11-09" # the first real drops wait for the coordinator's approvalHAS_INSIDERS: ${{ secrets.INSIDERS_REPO_TOKEN != '' }}@@ -48,7 +51,7 @@ jobs:CCACHE_MAXSIZE: 500MCCACHE_DEPEND: 'true'steps:- - uses: actions/checkout@v7+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1- name: Datesenv:IN_DATE: ${{ inputs.date }}@@ -71,11 +74,12 @@ jobs:echo "$DATE: $MODE"- name: Insider repositoryif: env.HAS_INSIDERS == 'true'- uses: actions/checkout@v7+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:repository: islandmed/sculptforge-insiderstoken: ${{ secrets.INSIDERS_REPO_TOKEN }}path: insiders+ persist-credentials: false- name: Already done today?if: env.MODE != 'approve'run: |@@ -87,7 +91,7 @@ jobs:sudo apt-get install -y --no-install-recommends ccache xvfb libgl1-mesa-dri- name: Compiler cache (restore; CI's Linux cache)if: env.MODE != 'approve' || env.MONTH != ''- uses: actions/cache/restore@v5+ uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0with:path: .ccachekey: ccache-ci-linux-x86_64.${{ github.sha }}@@ -108,7 +112,7 @@ jobs:$([ "$MODE" = hold ] && echo --hold)- name: Drop for review (artifact)if: env.SKIP_DROP != '1' && env.MODE != 'approve'- uses: actions/upload-artifact@v7+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2with:name: drop-${{ env.DATE }}path: ${{ runner.temp }}/out/${{ env.DATE }}@@ -140,6 +144,8 @@ jobs:python3 tools/drops/drops.py post "$B" --webhook-env DISCORD_MEMBERS_WEBHOOK- name: Commit to the insider repositoryif: env.HAS_INSIDERS == 'true'+ env:+ INSIDERS_TOKEN: ${{ secrets.INSIDERS_REPO_TOKEN }}run: |if [ "$MODE" != approve ] && [ -f "$RUNNER_TEMP/out/$DATE/gate.json" ]; thenmkdir -p "insiders/$DROP_DIR" && cp -r "$RUNNER_TEMP/out/$DATE/." "insiders/$DROP_DIR/"@@ -149,7 +155,9 @@ jobs:if git diff --cached --quiet; then echo "nothing to commit"; exit 0; figit -c user.name="github-actions[bot]" -c user.email="41898282+github-actions[bot]@users.noreply.github.com" \commit -qm "Drop $DATE ($MODE)${MONTH:+, Insider Pack $MONTH}"- git push -q+ auth=$(printf 'x-access-token:%s' "$INSIDERS_TOKEN" | base64 -w0)+ echo "::add-mask::$auth"+ git -c http.https://github.com/.extraheader="AUTHORIZATION: basic $auth" push -q- name: Public pack listing (schedule and release)if: env.HAS_INSIDERS == 'true'run: |diff --git a/.github/workflows/insider-preview.yml b/.github/workflows/insider-preview.ymldeleted file mode 100644index fea564b2..00000000--- a/.github/workflows/insider-preview.yml+++ /dev/null@@ -1,152 +0,0 @@-name: Members early build--# Members' early builds: the next release's packages, early, as a prerelease in the private repository-# islandmed/sculptforge-insiders (Member and Studio members are invited to it), announced in #members on Discord.-# (Betas, X.Y.Z-beta.N, go there through release.yml; this one shares any commit in between.)-#-# Run workflow with a version label (e.g. 0.10.8-preview.1) and an optional ref (default main).-# push to a preview/* branch; the label is the project version plus "-preview.<run number>".-#-# locate a successful Packages run (packages.yml) for exactly this commit: its tested artifacts are promoted-# unchanged. Otherwise:-# build the Packages workflow runs here for the commit (each package built and tested exactly as a release ships it).-# publish checksums, then the prerelease in the private repository, then the Discord post.-#-# Secrets (both optional; without them the workflow skips quietly and builds nothing):-# INSIDERS_REPO_TOKEN a fine-grained personal access token, resource owner islandmed, repository access-# "Only select repositories: islandmed/sculptforge-insiders", repository permission-# Contents: Read and write (Metadata: Read-only is added by GitHub). Nothing else: it-# can't touch this repository or any other.-# DISCORD_MEMBERS_WEBHOOK a webhook of the private #members channel (Channel settings > Integrations).-# Only publish sees them. The public release stays free for everyone; this only shares builds earlier. Bug-fix and-# security releases go out to everyone the same day through release.yml, never through here.--on:- push:- branches: ['preview/*']- workflow_dispatch:- inputs:- label:- description: Version label, e.g. 0.10.8-preview.1- required: true- type: string- ref:- description: Branch, tag or commit to preview (default main)- required: false- type: string--permissions:- contents: read--concurrency:- group: insider-preview-${{ github.ref }}- cancel-in-progress: true--jobs:- locate:- name: Locate tested packages- runs-on: ubuntu-24.04- permissions:- contents: read- actions: read- outputs:- enabled: ${{ steps.find.outputs.enabled }}- run-id: ${{ steps.find.outputs.run-id }}- sha: ${{ steps.find.outputs.sha }}- label: ${{ steps.find.outputs.label }}- steps:- - uses: actions/checkout@v7- with: { ref: '${{ inputs.ref || github.sha }}' }- - id: find- env:- GH_TOKEN: ${{ github.token }}- REPO: ${{ github.repository }}- HAS_TOKEN: ${{ secrets.INSIDERS_REPO_TOKEN != '' }}- LABEL: ${{ inputs.label }}- RUN_NUMBER: ${{ github.run_number }}- run: |- if [ "$HAS_TOKEN" != true ]; then- echo "No INSIDERS_REPO_TOKEN secret: skipped"- echo "enabled=false" >> "$GITHUB_OUTPUT"- exit 0- fi- echo "enabled=true" >> "$GITHUB_OUTPUT"- sha=$(git rev-parse HEAD)- version=$(sed -n 's/^project(SculptForge VERSION \([0-9.]*\).*/\1/p' CMakeLists.txt)- label=${LABEL:-$version-preview.$RUN_NUMBER}- label=${label#v}- if ! printf '%s' "$label" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$'; then- echo "::error::Version label '$label' should look like 0.10.8-preview.1"- exit 1- fi- echo "sha=$sha" >> "$GITHUB_OUTPUT"- echo "label=$label" >> "$GITHUB_OUTPUT"- # A successful Packages run for exactly this commit, from this repository's own workflow file.- run=$(gh api "repos/$REPO/actions/workflows/packages.yml/runs?head_sha=$sha&status=success&per_page=5" \- --jq '.workflow_runs[] | select(.head_sha == "'"$sha"'" and .path == ".github/workflows/packages.yml"- and .head_repository.full_name == "'"$REPO"'") | .id' | head -1 || true)- if [ -n "$run" ]; then- echo "Promoting the tested packages of Packages run $run for $sha as v$label"- echo "run-id=$run" >> "$GITHUB_OUTPUT"- else- echo "No successful Packages run for $sha: building and testing the packages here"- fi-- build:- name: Build- needs: locate- if: needs.locate.outputs.enabled == 'true' && needs.locate.outputs.run-id == ''- uses: ./.github/workflows/packages.yml- with:- ref: ${{ needs.locate.outputs.sha }}- tag: v${{ needs.locate.outputs.label }}-- publish:- name: Publish to the Insiders repository- needs: [locate, build]- if: ${{ !cancelled() && needs.locate.outputs.enabled == 'true' && (needs.build.result == 'success' || needs.build.result == 'skipped') }}- runs-on: ubuntu-24.04- permissions:- contents: read- actions: read # the packages may be another run's artifacts- env:- TAG: v${{ needs.locate.outputs.label }}- SHA: ${{ needs.locate.outputs.sha }}- steps:- - uses: actions/download-artifact@v8- with:- path: dist- merge-multiple: true- pattern: '{linux,flatpak,vfx,macos,windows}*'- run-id: ${{ needs.locate.outputs.run-id || github.run_id }}- github-token: ${{ github.token }}- - name: Checksums- run: |- [ -n "$(ls -A dist)" ] || { echo "::error::No packages found"; exit 1; }- cd dist && sha256sum * > SHA256SUMS.txt && cat SHA256SUMS.txt- - name: Prerelease in islandmed/sculptforge-insiders- env:- GH_TOKEN: ${{ secrets.INSIDERS_REPO_TOKEN }}- SOURCE: ${{ github.repository }}- run: |- cat > notes.md <<EOF- SculptForge ${TAG#v}, a members' early build of the next release (commit ${SHA::7} of $SOURCE).- The same packages and tests as a public release. Please report problems in #members or on GitHub.-- Every release stays free for everyone; bug-fix and security releases go out to everyone the same day.- EOF- repo=islandmed/sculptforge-insiders- gh release view "$TAG" --repo "$repo" >/dev/null 2>&1 ||- gh release create "$TAG" --repo "$repo" --prerelease --title "SculptForge ${TAG#v} (members' early build)" \- --notes-file notes.md- gh release upload "$TAG" dist/* --repo "$repo" --clobber- - name: Post to #members- env:- WEBHOOK: ${{ secrets.DISCORD_MEMBERS_WEBHOOK }}- run: |- if [ -z "$WEBHOOK" ]; then echo "No DISCORD_MEMBERS_WEBHOOK secret: skipped"; exit 0; fi- url="https://github.com/islandmed/sculptforge-insiders/releases/tag/$TAG"- jq -n --arg c "**SculptForge ${TAG#v} early build is up** for members: $url" \- '{content: $c, allowed_mentions: {parse: []}}' |- curl -fsS -H 'Content-Type: application/json' -d @- "$WEBHOOK" >/dev/null- echo "Posted to #members"diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 7a11b3c3..acf54601 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -11,12 +11,13 @@ name: Release# smoke every package installed or unpacked on a fresh runner: the app opens a model and sculpts# (tests/ui/release_smoke.sfui), sculptforge-cli opens, sculpts, saves and reopens (tests/release_smoke.py).# publish only after every smoke test passed: checksums, notes from CHANGELOG.md, the GitHub release. A tag with-# a '-' (a beta) is a member perk: published as a pre-release in the private repository-# islandmed/sculptforge-insiders (INSIDERS_REPO_TOKEN: a fine-grained token for that repository only,-# Contents: read and write) with CHANGELOG's [Unreleased] notes, and posted in #members-# (DISCORD_MEMBERS_WEBHOOK). Nothing public: no release here, no update feed entry.+# a '-' (a beta) is a member perk, published by publish-members instead: a pre-release in the private+# repository islandmed/sculptforge-insiders (INSIDERS_REPO_TOKEN, held only by the environment+# member-release: v* tags only, maintainer approval) with CHANGELOG's [Unreleased] notes, and posted in+# #members (DISCORD_MEMBERS_WEBHOOK). Nothing public: no release here, no update feed entry.#-# Only publish holds a token that can write (contents: write); every other job reads. Build and smoke jobs take their+# Only publish holds a GitHub token that can write (contents: write); every other job reads. Every action is pinned+# to a full commit SHA (scripts/release.sh check enforces it). Build and smoke jobs take their# runner from the SF_RUNNER_* repository variables (standard GitHub runners when unset); locate and publish always run# on GitHub's own runners.# workflow_dispatch rebuilds and republishes an existing tag; dry_run does everything but publish, and promote_run@@ -56,7 +57,7 @@ jobs:sha: ${{ steps.find.outputs.sha }}tag: ${{ steps.find.outputs.tag }}steps:- - uses: actions/checkout@v7+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with: { ref: '${{ env.TAG }}', fetch-depth: 20 } # the commits before the bump, for the paperwork check- id: findenv:@@ -152,14 +153,14 @@ jobs:- if: matrix.kind == 'rpm'run: dnf -y install git tar python3 xorg-x11-server-Xvfb mesa-dri-drivers# The smoke scripts and the test model come from the workflow's own commit (the tag, when a tag runs this).- - uses: actions/checkout@v7+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:sparse-checkout: |tests/release_smoke.pytests/ui/release_smoke.sfuitests/data/marble-bust.glbsparse-checkout-cone-mode: false- - uses: actions/download-artifact@v8+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2with:name: ${{ matrix.artifact }}path: pkg@@ -224,7 +225,7 @@ jobs:--ui-test "$PWD/tests/ui/release_smoke.sfui" --ui-out "$PWD/shots/rpm"- name: Screenshotsif: always()- uses: actions/upload-artifact@v7+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2with:name: smoke-shots-${{ matrix.artifact }}path: shots@@ -233,15 +234,15 @@ jobs:publish:name: Publish GitHub Releaseneeds: [locate, build, smoke]- if: ${{ !cancelled() && needs.smoke.result == 'success' && inputs.dry_run != true }}+ if: ${{ !cancelled() && needs.smoke.result == 'success' && inputs.dry_run != true && !contains(needs.locate.outputs.tag, '-') }}runs-on: ubuntu-24.04permissions:contents: writeactions: readsteps:- - uses: actions/checkout@v7- with: { ref: '${{ env.TAG }}' }- - uses: actions/download-artifact@v8+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1+ with: { ref: '${{ env.TAG }}', persist-credentials: false }+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2with:path: distmerge-multiple: true@@ -252,7 +253,6 @@ jobs:run: |cd distV=${TAG#v}- V=${V%%-*} # a beta's packages carry its version without the prerelease (the app shows it)cp "SculptForge-$V-windows-x86_64.exe" SculptForge-windows-x86_64-setup.execp "SculptForge-$V-windows-x86_64.zip" SculptForge-windows-x86_64-portable.zipcp "SculptForge-$V-darwin-universal.dmg" SculptForge-macos.dmg@@ -267,7 +267,6 @@ jobs:- name: Blender add-on (extension and legacy zips, plus a version-less copy for the website's link)run: |V=${TAG#v}- V=${V%%-*}python3 addons/blender/build_addon.py --check --version "$V" --out distcp "dist/sculptforge_bridge-$V.zip" dist/sculptforge_bridge.zip- name: Maya shelf script (Python source and its README; nothing to build)@@ -276,31 +275,64 @@ jobs:run: cd dist && sha256sum * > SHA256SUMS.txt && cat SHA256SUMS.txt- name: Release notes from CHANGELOGrun: |- section=${TAG#v}- if [[ "$TAG" == *-* ]]; then # a beta: what has changed since the stable release- section=Unreleased- printf '%s\n\n' "**Members' beta.** Thank you for being a member! Please report problems in #members on Discord (or a GitHub issue) with your OS, this version (Help > About) and your graphics card." > notes.md- fi- awk -v h="## [$section]" 'index($0, h) == 1 {flag=1;next} /^## \[/{flag=0} flag' CHANGELOG.md >> notes.md+ awk -v h="## [${TAG#v}]" 'index($0, h) == 1 {flag=1;next} /^## \[/{flag=0} flag' CHANGELOG.md > notes.mdcat packaging/release-notes-footer.md >> notes.md- name: Create or update the releaseenv:GH_TOKEN: ${{ github.token }}- INSIDERS_TOKEN: ${{ secrets.INSIDERS_REPO_TOKEN }}run: |- if [[ "$TAG" == *-* ]]; then # v0.11.0-beta.1: "SculptForge 0.11.0 Beta 1", members only, a pre-release- [ -n "$INSIDERS_TOKEN" ] || { echo "::error::No INSIDERS_REPO_TOKEN secret: a beta is published only in islandmed/sculptforge-insiders"; exit 1; }- export GH_TOKEN=$INSIDERS_TOKEN GH_REPO=islandmed/sculptforge-insiders- pre=${TAG#*-}- title="SculptForge ${TAG%%-*} $(sed -E 's/^rc/RC/; s/^./\U&/; s/\./ /g' <<<"$pre")"- gh release view "$TAG" >/dev/null 2>&1 ||- gh release create "$TAG" --title "${title/SculptForge v/SculptForge }" --notes-file notes.md --prerelease --latest=false- else- gh release view "$TAG" >/dev/null 2>&1 || gh release create "$TAG" --title "SculptForge ${TAG#v}" --notes-file notes.md- fi+ gh release view "$TAG" >/dev/null 2>&1 || gh release create "$TAG" --title "SculptForge ${TAG#v}" --notes-file notes.md+ gh release upload "$TAG" dist/* --clobber++ # A beta (a tag with a '-') is a member perk, published only in the private repository islandmed/sculptforge-insiders.+ # INSIDERS_REPO_TOKEN lives only in the GitHub Environment "member-release" (deployment: tags v* only; the maintainer+ # approves each run), so no other job, workflow or branch can read it. This job's GitHub token only reads; the+ # insiders token reaches exactly one step, as an env var. Runs only for the tag push itself (the environment refuses+ # a workflow_dispatch from a branch); scripts/release.sh check enforces the environment and pinned actions.+ publish-members:+ name: Publish members' beta+ needs: [locate, build, smoke]+ if: ${{ !cancelled() && needs.smoke.result == 'success' && inputs.dry_run != true && contains(needs.locate.outputs.tag, '-') }}+ runs-on: ubuntu-24.04+ environment: member-release+ permissions:+ contents: read+ actions: read # the packages may be another run's artifacts+ steps:+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1+ with: { ref: '${{ env.TAG }}', persist-credentials: false }+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2+ with:+ path: dist+ merge-multiple: true+ pattern: '{linux,flatpak,vfx,macos,windows}*'+ run-id: ${{ needs.locate.outputs.run-id || github.run_id }}+ github-token: ${{ github.token }}+ - name: Blender add-on and Maya shelf script+ run: |+ V=${TAG#v}+ V=${V%%-*} # a beta's packages carry its version without the prerelease (the app shows it)+ python3 addons/blender/build_addon.py --check --version "$V" --out dist+ python3 -m zipfile -c dist/sculptforge_maya.zip integrations/maya/sculptforge_maya.py integrations/maya/README.md+ - name: Checksums+ run: cd dist && sha256sum * > SHA256SUMS.txt && cat SHA256SUMS.txt+ - name: Release notes (CHANGELOG's [Unreleased])+ run: |+ printf '%s\n\n' "**Members' beta.** Thank you for being a member! Please report problems in #members on Discord (or a GitHub issue) with your OS, this version (Help > About) and your graphics card." > notes.md+ awk -v h="## [Unreleased]" 'index($0, h) == 1 {flag=1;next} /^## \[/{flag=0} flag' CHANGELOG.md >> notes.md+ cat packaging/release-notes-footer.md >> notes.md+ - name: Pre-release in islandmed/sculptforge-insiders+ env:+ GH_TOKEN: ${{ secrets.INSIDERS_REPO_TOKEN }}+ GH_REPO: islandmed/sculptforge-insiders+ run: |+ [ -n "$GH_TOKEN" ] || { echo "::error::No INSIDERS_REPO_TOKEN in the member-release environment"; exit 1; }+ pre=${TAG#*-}+ title="SculptForge ${TAG%%-*} $(sed -E 's/^rc/RC/; s/^./\U&/; s/\./ /g' <<<"$pre")" # v0.11.0-beta.1: "SculptForge 0.11.0 Beta 1"+ gh release view "$TAG" >/dev/null 2>&1 ||+ gh release create "$TAG" --title "${title/SculptForge v/SculptForge }" --notes-file notes.md --prerelease --latest=falsegh release upload "$TAG" dist/* --clobber- - name: Post a beta in #members- if: contains(env.TAG, '-')+ - name: Post the beta in #membersenv:WEBHOOK: ${{ secrets.DISCORD_MEMBERS_WEBHOOK }}run: |diff --git a/CMakeLists.txt b/CMakeLists.txtindex 5cfc4106..f655eec0 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -722,6 +722,10 @@ if(SCULPTFORGE_BUILD_TESTS)add_test(NAME marks_self_test COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/check_marks.py --self-test)add_test(NAME release_notes COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/release/assemble_notes.py --self-test)add_test(NAME release_notes_fragments COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/release/assemble_notes.py --check)+ # The members' publishing path stays locked down: release.yml's actions pinned to commit SHAs, INSIDERS_REPO_TOKEN only+ # in GitHub Environments, no pull_request_target (tools/release/check_workflows.py; release.sh check runs it too).+ add_test(NAME release_workflows COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/release/check_workflows.py)+ add_test(NAME release_workflows_self_test COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/release/check_workflows.py --self-test)add_test(NAME release_paperwork COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/release/paperwork_only.py --self-test)# scripts/release.sh's beta (X.Y.Z-beta.N) and its promotion to stable, in a sandbox with stand-ins for gh and curl.if(UNIX AND NOT APPLE AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)diff --git a/docs/releasing.md b/docs/releasing.mdindex ac6aba6c..845034fb 100644--- a/docs/releasing.md+++ b/docs/releasing.md@@ -110,6 +110,9 @@ HIGHLIGHTS=highlights.txt scripts/release.sh 0.12.0 --yes # later: the stablegh api -X PUT repos/islandmed/sculptforge-insiders/collaborators/USERNAME -f permission=pull # a new member```+Members are **always** invited with `permission=pull` (read: download releases, nothing else); never `push`,+`maintain` or `admin`. Check with `gh api repos/islandmed/sculptforge-insiders/collaborators --jq '.[]|.login+" "+.role_name'`.+Steps for a beta: `bump check ci tag release status`.- **bump** writes the note fragments into CHANGELOG `[Unreleased]` and What's New `0.12.0` (date stays `unreleased`), and@@ -117,11 +120,12 @@ Steps for a beta: `bump check ci tag release status`.`VERSION 0.12.0` and `set(SCULPTFORGE_PRERELEASE "beta.1")`. The app reads "0.12.0 Beta 1" in the title bar andAbout; packages are named `SculptForge-0.12.0-*`. CITATION, rez, metainfo, the CHANGELOG section and the home pagestay at the stable release (`build_site.py` leaves the home page alone while a prerelease is set).-- **check** checks CMakeLists.txt (version and prerelease), the guide, the DPI tests, that the repository has the- `INSIDERS_REPO_TOKEN` secret and that gh can see the private repository. A beta skips the site/AUR/Homebrew/Omarchy+- **check** checks CMakeLists.txt (version and prerelease), the guide, the DPI tests, the workflows (below, "Secrets"),+ that the `member-release` environment has the `INSIDERS_REPO_TOKEN` secret and that gh can see the private repository. A beta skips the site/AUR/Homebrew/Omarchychecks.- **tag / release**: `v0.12.0-beta.1` (the tag is public, like the source). release.yml checks that the tag equals the- version plus the prerelease, then publishes a **pre-release in islandmed/sculptforge-insiders** with+ version plus the prerelease, then its job `publish-members` waits for the maintainer's approval (one click in the+ run, or `gh run view`), publishes a **pre-release in islandmed/sculptforge-insiders** with`INSIDERS_REPO_TOKEN` (a fine-grained token for that repository only, Contents: read and write), and posts it in#members (`DISCORD_MEMBERS_WEBHOOK`). Nothing is published in the public repository, and the update feed isuntouched: the app's Preview channel offers only what the feed names.@@ -133,6 +137,28 @@ after the beta's. Step `site` removes any older `channels.preview` entry (from tapp, Preview never offers anything older than stable. The beta's tag doesn't get in the way: stable releases takethe guide from the newest tag without a `-` (pages.yml). A second beta is `0.12.0-beta.2`.+### Secrets (the members' publishing path)++What keeps the insiders token from leaking; `tools/release/check_workflows.py` (run by release.sh check and ctest+`release_workflows`) fails when the workflow side of it breaks.++- `INSIDERS_REPO_TOKEN` exists only as an **environment secret**, never at repository level:+ - `member-release` (release.yml `publish-members`): deployment only from tags `v*`, required reviewer islandmed+ (self-review allowed: solo maintainer). A workflow_dispatch from a branch can't use it.+ - `member-drops` (insider-drop.yml, the daily drop): deployment only from `main`, no reviewer (it runs on a schedule).+ - Set or rotate (never echo it): `wl-paste -n | gh secret set INSIDERS_REPO_TOKEN --env member-release -R islandmed/SculptForge`+ (same with `--env member-drops`).+- release.yml: top-level `permissions: contents: read`; `publish-members` reads only, runs only for betas, and passes+ the token as an env var to its one publishing step; every `uses:` pinned to a full commit SHA with the version in a+ comment (update by resolving the new tag: `gh api repos/OWNER/REPO/git/ref/tags/vX.Y.Z --jq .object.sha`); checkouts+ don't persist credentials; no `set -x`.+- No workflow uses `pull_request_target`; fork pull requests get no secrets (GitHub's default for `pull_request`), and+ every outside contributor's run waits for approval.+- Repository: secret scanning and push protection on, Dependabot alerts and security updates on, the default workflow+ token read-only, Actions may not create or approve pull requests.+- islandmed/sculptforge-insiders: private, members invited with `permission=pull` only, ruleset on `main`: no force+ push, no deletion.+## When a step failsThe script stops with a line starting `fix:` and the command to resume (`--from <step>`). Fix that one thing, thendiff --git a/scripts/release.sh b/scripts/release.shindex 6e14ace2..a64e013c 100755--- a/scripts/release.sh+++ b/scripts/release.sh@@ -227,7 +227,7 @@ dpi_ok() {# Everything the steps after the tag need that doesn't depend on the release existing. The home page card is# checked through the features block until bump writes it.preflight() {- local mode=${1:-} t auth pr state owner branch pk+ local mode=${1:-} t auth pr state owner branch pk outfor t in git gh curl python3 base64 awk; do command -v "$t" >/dev/null || die "$t is not installed" "install $t"; donecommand -v sha256sum >/dev/null || command -v shasum >/dev/null || die "no sha256sum or shasum" "install coreutils"auth=$(gh auth status 2>&1 || true)@@ -236,10 +236,13 @@ preflight() {grep -q '^set(SCULPTFORGE_PRERELEASE "[a-z0-9.]*")$' CMakeLists.txt ||die "CMakeLists.txt lost its set(SCULPTFORGE_PRERELEASE \"\") line that step bump sets" "restore it under project() (git log -p CMakeLists.txt), commit"python3 -c 'import json, sys; json.load(open(sys.argv[1]))' website/latest.json 2>/dev/null || die "website/latest.json is not valid JSON" "fix it, commit"+ # The members' publishing path: release.yml's actions pinned to commit SHAs, INSIDERS_REPO_TOKEN only in the+ # member-release environment (docs/releasing.md, "Secrets").+ out=$(python3 tools/release/check_workflows.py 2>&1) || die "the release workflows aren't locked down: $out" "fix .github/workflows (docs/releasing.md, \"Secrets\"), commit, push main"if [ -n "$PRE" ]; then # a beta: members only, through the private repository; nothing of the site, no packages- gh secret list -R "$REPO" 2>/dev/null | grep -q '^INSIDERS_REPO_TOKEN\b' ||- die "the repository has no INSIDERS_REPO_TOKEN secret, so release.yml can't publish the beta to $INSIDERS_REPO" \- "the owner creates it (fine-grained token, only $INSIDERS_REPO, Contents: read and write): gh secret set INSIDERS_REPO_TOKEN -R $REPO"+ gh secret list --env member-release -R "$REPO" 2>/dev/null | grep -q '^INSIDERS_REPO_TOKEN\b' ||+ die "the member-release environment has no INSIDERS_REPO_TOKEN, so release.yml can't publish the beta to $INSIDERS_REPO" \+ "the owner pastes it (fine-grained token, only $INSIDERS_REPO, Contents: read and write): wl-paste -n | gh secret set INSIDERS_REPO_TOKEN --env member-release -R $REPO"gh repo view "$INSIDERS_REPO" >/dev/null 2>&1 || die "can't see $INSIDERS_REPO" "gh auth status: log in as the owner of $INSIDERS_REPO"ok "What's New $BASE is ready and $INSIDERS_REPO takes the beta (a beta has no site, package or reply steps)"returndiff --git a/tests/release_beta_test.sh b/tests/release_beta_test.shindex 68b5bda0..2b2472e4 100755--- a/tests/release_beta_test.sh+++ b/tests/release_beta_test.sh@@ -21,11 +21,11 @@ quiet() { "$@" >"$S/out.log" 2>&1 || { cat "$S/out.log" >&2; fail "$* exited $?"# --- the sandbox -----------------------------------------------------------------------------------------------------git clone -q --shared --no-checkout "$ROOT" "$S/repo"cd "$S/repo"-git sparse-checkout set --no-cone /CMakeLists.txt /CHANGELOG.md /CITATION.cff /packaging/ /docs/ /tools/ /website/ \+git sparse-checkout set --no-cone /.github/workflows/ /CMakeLists.txt /CHANGELOG.md /CITATION.cff /packaging/ /docs/ /tools/ /website/ \/scripts/ /changes/ /tests/ui/whats_new.sfuigit checkout -q -B main "$(git -C "$ROOT" rev-parse HEAD)"# This checkout's uncommitted changes (the tree being tested), then one commit on main.-(cd "$ROOT" && git diff --name-only HEAD -- CMakeLists.txt CHANGELOG.md packaging docs tools website scripts changes tests/ui/whats_new.sfui) |+(cd "$ROOT" && git diff --name-only HEAD -- .github/workflows CMakeLists.txt CHANGELOG.md packaging docs tools website scripts changes tests/ui/whats_new.sfui) |while read -r f; doif [ -e "$ROOT/$f" ]; then mkdir -p "$(dirname "$f")" && cp "$ROOT/$f" "$f"; else rm -f "$f"; fidonediff --git a/tools/release/check_workflows.py b/tools/release/check_workflows.pynew file mode 100755index 00000000..5e6a323b--- /dev/null+++ b/tools/release/check_workflows.py@@ -0,0 +1,147 @@+#!/usr/bin/env python3+# SculptForge - open source digital sculpting+# SPDX-License-Identifier: GPL-3.0-or-later+"""The members' publishing path stays locked down (docs/releasing.md, "Secrets"). scripts/release.sh check and ctest+(release_workflows) run this; it fails when++ - release.yml has a `uses:` that isn't a local workflow or pinned to a full 40-hex commit SHA,+ - release.yml has no job in `environment: member-release` holding INSIDERS_REPO_TOKEN, or that job can write+ (contents: write) or isn't limited to betas,+ - any workflow's job reads INSIDERS_REPO_TOKEN outside a GitHub Environment (environment secrets are invisible+ there anyway, so such a job is a sign someone put the token back at repository level),+ - any workflow uses pull_request_target, or release.yml turns on shell tracing (set -x) that would log values.++Plain text parsing (no PyYAML): workflows here keep jobs at two spaces and their keys at four.+"""+import re+import sys+from pathlib import Path++TOKEN = "secrets.INSIDERS_REPO_TOKEN"+MEMBER_ENV = "member-release"+PINNED = re.compile(r"^[\w.-]+/[\w./-]+@[0-9a-f]{40}(\s+#\s*\S.*)?$")+++def jobs(text):+ """{job id: its lines} for the top-level `jobs:` block."""+ out, cur, inside = {}, None, False+ for line in text.splitlines():+ if re.match(r"^jobs:\s*$", line):+ inside = True+ continue+ if inside and re.match(r"^\S", line):+ inside = False+ if not inside:+ continue+ m = re.match(r"^ ([\w-]+):\s*$", line)+ if m:+ cur = m.group(1)+ out[cur] = []+ elif cur:+ out[cur].append(line)+ return out+++def environment(lines):+ for line in lines:+ m = re.match(r"^ environment:\s*(\S.*?)\s*$", line)+ if m:+ return m.group(1).strip("'\"")+ return None+++def check(files):+ """files: {name: text}. Returns the list of problems."""+ errs = []+ for name, text in files.items():+ if re.search(r"^\s*pull_request_target\s*:", text, re.M) or re.search(r"\bpull_request_target\b", text.split("jobs:")[0]):+ errs.append(f"{name}: pull_request_target (runs outside code with this repository's secrets)")+ for job, lines in jobs(text).items():+ if any(TOKEN in l for l in lines) and not environment(lines):+ errs.append(f"{name}: job {job} reads INSIDERS_REPO_TOKEN outside a GitHub Environment")+ rel = files.get("release.yml")+ if rel is None:+ return errs + ["release.yml: missing"]+ for n, line in enumerate(rel.splitlines(), 1):+ m = re.match(r"^\s*(?:-\s+)?uses:\s*(\S.*?)\s*$", line)+ if m and not m.group(1).startswith("./") and not PINNED.match(m.group(1)):+ errs.append(f"release.yml:{n}: `uses: {m.group(1)}` is not pinned to a full commit SHA (pin it, comment the version)")+ if re.search(r"(^|[\s;])set\s+-[a-wyz]*x", line):+ errs.append(f"release.yml:{n}: shell tracing (set -x) would log secret-derived values")+ holders = {j: l for j, l in jobs(rel).items() if any(TOKEN in x for x in l)}+ if not holders:+ errs.append("release.yml: no job publishes to the insiders repository with INSIDERS_REPO_TOKEN")+ for job, lines in holders.items():+ body = "\n".join(lines)+ if environment(lines) != MEMBER_ENV:+ errs.append(f"release.yml: job {job} holds INSIDERS_REPO_TOKEN but isn't in `environment: {MEMBER_ENV}`")+ if re.search(r"contents:\s*write", body):+ errs.append(f"release.yml: job {job} holds INSIDERS_REPO_TOKEN and a GitHub token that can write")+ if "contains(needs.locate.outputs.tag, '-')" not in body:+ errs.append(f"release.yml: job {job} isn't limited to betas (if: ... contains(needs.locate.outputs.tag, '-'))")+ if sum(TOKEN in x for x in lines) != 1:+ errs.append(f"release.yml: job {job} should pass INSIDERS_REPO_TOKEN to exactly one step")+ return errs+++GOOD = """on:+ push:+ tags: ['v*']+permissions:+ contents: read+jobs:+ build:+ runs-on: ubuntu-24.04+ steps:+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1+ - uses: ./.github/workflows/packages.yml+ publish-members:+ if: ${{ contains(needs.locate.outputs.tag, '-') }}+ environment: member-release+ permissions:+ contents: read+ steps:+ - name: Publish+ env:+ GH_TOKEN: ${{ secrets.INSIDERS_REPO_TOKEN }}+ run: gh release create+"""+++def self_test():+ cases = {+ "good": ({"release.yml": GOOD}, 0),+ "unpinned": ({"release.yml": GOOD.replace("checkout@3d3c42e5aac5ba805825da76410c181273ba90b1", "checkout@v7")}, 1),+ "short sha": ({"release.yml": GOOD.replace("3d3c42e5aac5ba805825da76410c181273ba90b1", "3d3c42e")}, 1),+ "no environment": ({"release.yml": GOOD.replace(" environment: member-release\n", "")}, 1),+ "other environment": ({"release.yml": GOOD.replace("member-release", "production")}, 1),+ "write token": ({"release.yml": GOOD.replace(" contents: read\n steps", " contents: write\n steps")}, 1),+ "not beta-only": ({"release.yml": GOOD.replace("contains(needs.locate.outputs.tag, '-')", "true")}, 1),+ "set -x": ({"release.yml": GOOD.replace("run: gh release create", "run: set -ex; gh release create")}, 1),+ "no publisher": ({"release.yml": GOOD.replace(TOKEN, "github.token")}, 1),+ "prt": ({"release.yml": GOOD, "x.yml": "on:\n pull_request_target:\njobs:\n a:\n steps: []\n"}, 1),+ "repo-level reader": ({"release.yml": GOOD, "x.yml": f"jobs:\n a:\n env:\n T: ${{{{ {TOKEN} }}}}\n"}, 1),+ "env reader ok": ({"release.yml": GOOD, "x.yml": f"jobs:\n a:\n environment: member-drops\n env:\n T: ${{{{ {TOKEN} }}}}\n"}, 0),+ }+ bad = [f"{k}: {check(f)}" for k, (f, n) in cases.items() if bool(check(f)) != bool(n)]+ for b in bad:+ print("self-test FAIL", b)+ print("self-test", "failed" if bad else "ok")+ return 1 if bad else 0+++def main():+ if "--self-test" in sys.argv:+ return self_test()+ root = Path(__file__).resolve().parents[2] / ".github" / "workflows"+ files = {p.name: p.read_text() for p in sorted(root.glob("*.yml"))}+ errs = check(files)+ for e in errs:+ print(e)+ if not errs:+ print(f"workflows ok: release.yml pinned, INSIDERS_REPO_TOKEN only in environments ({len(files)} workflows)")+ return 1 if errs else 0+++if __name__ == "__main__":+ sys.exit(main())