Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/promote.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: promote

# Hands a tested version to every PC (0.5.8). release.yml publishes a new version as a TEST version (a
# pre-release), which installed PCs do not take by themselves because GitHub's "latest release" is never a
# pre-release. Once it has been tried on the test PCs: Actions > promote > Run workflow. This turns the
# pre-release into a full release, marks it as the latest and rewrites its text from CHANGELOG.md (on the branch
# the workflow runs from) without the test note. PCs then offer it within a day (docs/releasing.md).

on:
workflow_dispatch:
inputs:
version:
description: 'Version to hand to every PC, for example 0.5.8 (empty: the one in Directory.Build.props)'
required: false
default: ''

permissions:
contents: write

jobs:
promote:
name: Hand the tested version to every PC
runs-on: ubuntu-latest

steps:
- name: Check out
uses: actions/checkout@v4

- name: Make it a full release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
REQUESTED: ${{ inputs.version }}
run: |
set -euo pipefail
version="${REQUESTED:-$(sed -n 's:.*<Version>\(.*\)</Version>.*:\1:p' Directory.Build.props | head -n 1)}"
if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::\"$version\" is not a version like 0.5.8."
exit 1
fi
tag="v$version"
if ! assets=$(gh release view "$tag" --json assets --jq '.assets[].name'); then
echo "::error::There is no release $tag. Publish it as a test version first (Actions, release, Run workflow)."
exit 1
fi
for name in "PrintVect-Setup-$version.exe" "PrintVect-Setup-$version.exe.sha256"; do
if ! grep -qxF "$name" <<<"$assets"; then
echo "::error::Release $tag lacks $name, so it cannot go to every PC. Run the release workflow for it again."
exit 1
fi
done
python3 tools/release_notes.py "$version" --out release-notes.md
gh release edit "$tag" --prerelease=false --latest --notes-file release-notes.md
echo "::notice::$tag is now the latest release: every PC that runs PrintVect offers it within a day."
echo "https://github.com/$GITHUB_REPOSITORY/releases/tag/$tag"
57 changes: 42 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ name: release

# Publishes a GitHub Release carrying the setup program. Every installed PrintVect looks at the latest
# release once a day (Settings tab, Updates) and offers it with one click, so this is how an update
# reaches every PC. Three ways to start it (docs/releasing.md):
# 1. on the GitHub website: Releases > Draft a new release, new tag v<Version>, target = the branch, Publish;
# the setup program and its checksum are added to that release a few minutes later;
# reaches every PC. Since 0.5.8 a new version is published as a TEST version (a pre-release) first:
# GitHub's "latest release" is never a pre-release, so PCs do not install it by themselves. Once it has
# been tried, Actions > promote > Run workflow hands it to every PC. Ways to start this one (docs/releasing.md):
# 1. Actions > release > Run workflow (the tag is created from Directory.Build.props; "stage" picks a test
# version, the default, or straight to every PC);
# 2. push a tag that matches <Version> in Directory.Build.props: git tag v0.2.0 && git push origin v0.2.0
# 3. Actions > release > Run workflow (the tag is then created from Directory.Build.props).
# (a test version);
# 3. on the GitHub website: Releases > Draft a new release, new tag v<Version>, target = the branch, tick
# "Set as a pre-release" for a test version, Publish; the setup program and its checksum are added later.
# The release text is "what changed" from CHANGELOG.md (tools/release_notes.py), so write that section first.
# A version whose release already carries a setup program is left alone (warning in the run), so
# raise <Version> (all three lines in Directory.Build.props) before publishing the next one.

Expand All @@ -16,6 +21,12 @@ on:
release:
types: [published]
workflow_dispatch:
inputs:
stage:
description: 'test = a pre-release only the PCs you install it on get (promote it later); everyone = every PC at once'
type: choice
options: [test, everyone]
default: test

# A release made on the website fires both "push tag" and "release published": run them one after the other.
concurrency:
Expand Down Expand Up @@ -123,25 +134,41 @@ jobs:
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
# Run workflow picks the stage; a pushed tag makes a test version.
STAGE: ${{ github.event.inputs.stage || 'test' }}
run: |
$exe = "artifacts\installer\PrintVect-Setup-$env:VERSION.exe"
if ($env:EXISTING -eq '1') {
# The release was made on the website: just add the files to it.
# The release was made on the website: add the files to it, and its text when none was typed.
gh release upload $env:TAG $exe "$exe.sha256" --clobber
if ($LASTEXITCODE -ne 0) { throw "gh release upload failed with exit code $LASTEXITCODE" }
$existing = gh release view $env:TAG --json body,isPrerelease | ConvertFrom-Json
if ([string]::IsNullOrWhiteSpace($existing.body)) {
$noteArgs = @($env:VERSION, '--out', 'release-notes.md')
if ($existing.isPrerelease) { $noteArgs += '--test' }
python tools/release_notes.py @noteArgs
if ($LASTEXITCODE -ne 0) { throw "tools/release_notes.py failed with exit code $LASTEXITCODE" }
gh release edit $env:TAG --notes-file release-notes.md
if ($LASTEXITCODE -ne 0) { throw "gh release edit failed with exit code $LASTEXITCODE" }
}
} else {
$notes = "PrintVect $env:VERSION`n`n" +
"PrintVect shares a printer with every Windows PC and laptop on your network, at home or in the office, " +
"with no printer driver to install and no Windows password on the PCs that print. " +
"What it does and how to use it: https://github.com/rahulranjan-dev-py/PrintVect#readme`n`n" +
"Download **PrintVect-Setup-$env:VERSION.exe** and run it on a PC that does not have PrintVect yet. " +
"PCs that already run PrintVect find this version by themselves within a day (Settings tab, Updates) " +
"and install it with one click.`n`n" +
"The .sha256 file is the checksum PrintVect verifies after downloading."
$test = $env:STAGE -ne 'everyone'
$noteArgs = @($env:VERSION, '--out', 'release-notes.md')
if ($test) { $noteArgs += '--test' }
python tools/release_notes.py @noteArgs
if ($LASTEXITCODE -ne 0) { throw "tools/release_notes.py failed with exit code $LASTEXITCODE" }
# Draft first, then publish: the release never shows up without its files.
gh release create $env:TAG --target $env:GITHUB_SHA --title "PrintVect $env:VERSION" --notes $notes --draft $exe "$exe.sha256"
gh release create $env:TAG --target $env:GITHUB_SHA --title "PrintVect $env:VERSION" --notes-file release-notes.md --draft $exe "$exe.sha256"
if ($LASTEXITCODE -ne 0) { throw "gh release create failed with exit code $LASTEXITCODE" }
gh release edit $env:TAG --draft=false
if ($test) {
# A pre-release is never GitHub's "latest release", which is what installed PCs ask for.
gh release edit $env:TAG --draft=false --prerelease
} else {
gh release edit $env:TAG --draft=false --latest
}
if ($LASTEXITCODE -ne 0) { throw "gh release edit failed with exit code $LASTEXITCODE" }
if ($test) {
Write-Host "::notice::Published TEST version $env:TAG (pre-release): installed PCs do not take it by themselves. Once it works: Actions, promote, Run workflow."
}
}
Write-Host "Published https://github.com/$env:GITHUB_REPOSITORY/releases/tag/$env:TAG"
41 changes: 40 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,46 @@ Newest first. Each version is a [release](https://github.com/rahulranjan-dev-py/
program; PCs that run PrintVect offer the newest one by themselves (Settings, Updates). **Tested** says how far the
version was tried on the office's PCs (Windows 10 and 11).

## 0.5.7
## 0.5.8

Security fixes from a review of the design.

The sharing PIN is harder to steal and to guess. It never crosses the network any more, not even as the plain
SHA-256 hash earlier versions sent, which anyone watching the network could reuse as the password forever. Each job
carries a one-time proof of the PIN instead: it is made for that job only and works for nothing else. A PC that sends
5 wrong PINs has to wait 15 minutes before the PC with the printer checks its PIN again, twice as long each further
time (at most 4 hours). With a PIN, the list of PCs that print here only shows PCs that know the PIN. **Update every
PC**: with a sharing PIN, a PC on 0.5.7 and a PC on 0.5.8 cannot print to each other.

Another PC can no longer take over a printer by answering with the same PC name when the real one has moved or is
switched off. Each PC that shares printers now has its own secret identity key, and every PC that adds one of its
printers remembers it (printers added before learn it within a few minutes). A printer follows its PC to a new address
only when the PC there proves it holds that key; otherwise nothing is sent and the job says why.

The administrator helper can no longer be tricked through the shared data folder: every user may write in
`C:\ProgramData\PrintVect`, so another user could put a link (junction) there that leads to a Windows folder and wait
for the helper to give "Users: Modify" rights or delete files through it. The helper now refuses to create, change or
delete anything through such a link and says what to remove.

A PC that shares printers can no longer be flooded: it serves at most 32 connections at once (8 from one PC, and 120
new ones a minute from one PC), closes a connection that sends nothing within 15 seconds, keeps at most 1 GB of
documents waiting and stops taking more when its disk is nearly full (the job waits for Retry on the sending PC). A
file that is not a print document is deleted at once, and files kept after a failed print are deleted after a day,
checked every hour instead of only when sharing starts.

Updates are checked more strictly: a release without its checksum file is no longer installed (it used to install
after a size check only), and the downloaded setup program, which sits in a folder every user may write to, is held
so nobody can change it and checked again just before it starts.

New versions are published as test versions first: they reach only the PCs they are installed on by hand, and every
other PC gets them once they are handed over (Actions, promote). The release text now says what changed, taken from
this file.

The sharing PIN is no longer written in plain text in `config.json` (which every user of the PC can open): it is kept
protected by Windows for that PC, and a PIN saved by an earlier version is converted at the first start. The 10.8 MB
demo video left the repository's files; the README plays the copy uploaded to GitHub. **Tested:** awaiting test.

## 0.5.7 (2026-10-29)

The copies window: it opens about 2 to 3 seconds sooner after a program prints (the PC now looks at the finished
print file within half a second instead of waiting for its 2-second check), it is as tall as its content so the
Expand Down
Loading
Loading