Skip to content

Commit 6a72c51

Browse files
committed
Add release-prepare workflow + reset all versions to 0.0.1
New .github/workflows/release-prepare.yml is a workflow_dispatch tool that bumps versions across every package in a single commit, tags v<version>, and triggers release.yml. Patch is auto-incremented from reference/PCF-v1.0/Cargo.toml when no explicit version is provided. Files bumped per run: - 3x Cargo.toml (incl. pcf path-dep version pins in pfs-ms and pcf-debug) - implementations/ts/package.json (+ package-lock.json via npm version) - implementations/dotnet/src/Pcf/Pcf.csproj The triggered release.yml is now also called explicitly via 'gh workflow run' because GITHUB_TOKEN-pushed tags do not fire push triggers in other workflows. Also: - All packages reset to baseline 0.0.1 (was a mix of 1.0.0 / 0.1.0) so the first bump runs against a clean state. - Removed redundant 'Set workspace versions' (sed) step from release.yml publish-crates job and the 'Set version' (npm version) step from publish-npm; bumps now live in the prep commit.
1 parent 1c8744d commit 6a72c51

8 files changed

Lines changed: 125 additions & 21 deletions

File tree

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Prepare Release (bump versions, tag, trigger release)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'New version (e.g. 0.0.2). If empty, patch is incremented from reference/PCF-v1.0/Cargo.toml.'
8+
required: false
9+
type: string
10+
dry_run:
11+
description: 'Pass dry_run=true to the triggered Release workflow (no actual registry publish).'
12+
required: false
13+
type: boolean
14+
default: false
15+
16+
jobs:
17+
prepare:
18+
name: Bump versions and create release tag
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
actions: write
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: '22'
35+
36+
- name: Determine new version
37+
id: version
38+
shell: bash
39+
run: |
40+
set -euo pipefail
41+
CURRENT=$(grep -m1 '^version = ' reference/PCF-v1.0/Cargo.toml | sed 's/.*"\(.*\)".*/\1/')
42+
if ! [[ "$CURRENT" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
43+
echo "ERROR: Could not read a valid semver from reference/PCF-v1.0/Cargo.toml (got '$CURRENT')"
44+
exit 1
45+
fi
46+
47+
INPUT='${{ github.event.inputs.version }}'
48+
if [ -n "$INPUT" ]; then
49+
NEW="$INPUT"
50+
if ! [[ "$NEW" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
51+
echo "ERROR: Provided version '$NEW' is not a valid semantic version (expected X.Y.Z)"
52+
exit 1
53+
fi
54+
else
55+
IFS='.' read -r MAJOR MINOR PATCH <<<"$CURRENT"
56+
NEW="$MAJOR.$MINOR.$((PATCH + 1))"
57+
fi
58+
59+
echo "current=$CURRENT" >> "$GITHUB_OUTPUT"
60+
echo "version=$NEW" >> "$GITHUB_OUTPUT"
61+
echo "Bumping $CURRENT -> $NEW"
62+
63+
- name: Refuse to retag existing version
64+
shell: bash
65+
run: |
66+
if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
67+
echo "ERROR: tag v${{ steps.version.outputs.version }} already exists"
68+
exit 1
69+
fi
70+
71+
- name: Bump Rust Cargo.toml files
72+
shell: bash
73+
run: |
74+
set -euo pipefail
75+
NEW='${{ steps.version.outputs.version }}'
76+
sed -i 's/^version = "[^"]*"/version = "'"$NEW"'"/' reference/PCF-v1.0/Cargo.toml
77+
sed -i 's/^version = "[^"]*"/version = "'"$NEW"'"/' reference/PFS-MS-v1.0/Cargo.toml
78+
sed -i 's/^version = "[^"]*"/version = "'"$NEW"'"/' tools/pcf-debug/Cargo.toml
79+
# path-dep version pins on pcf
80+
sed -i 's|pcf = { path = "\.\./PCF-v1.0", version = "[^"]*" }|pcf = { path = "../PCF-v1.0", version = "'"$NEW"'" }|' reference/PFS-MS-v1.0/Cargo.toml
81+
sed -i 's|pcf = { path = "\.\./\.\./reference/PCF-v1.0", version = "[^"]*" }|pcf = { path = "../../reference/PCF-v1.0", version = "'"$NEW"'" }|' tools/pcf-debug/Cargo.toml
82+
83+
- name: Bump TypeScript package
84+
shell: bash
85+
working-directory: implementations/ts
86+
run: npm version '${{ steps.version.outputs.version }}' --no-git-tag-version --allow-same-version
87+
88+
- name: Bump .NET Pcf.csproj
89+
shell: bash
90+
run: |
91+
NEW='${{ steps.version.outputs.version }}'
92+
sed -i 's|<Version>[^<]*</Version>|<Version>'"$NEW"'</Version>|' implementations/dotnet/src/Pcf/Pcf.csproj
93+
94+
- name: Show diff
95+
run: git --no-pager diff --stat && git --no-pager diff
96+
97+
- name: Commit, tag and push
98+
shell: bash
99+
run: |
100+
set -euo pipefail
101+
NEW='${{ steps.version.outputs.version }}'
102+
git config user.name "github-actions[bot]"
103+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
104+
git add -A
105+
git commit -m "Bump version to v$NEW"
106+
git tag -a "v$NEW" -m "Release v$NEW"
107+
git push origin HEAD --follow-tags
108+
109+
- name: Trigger Release workflow
110+
env:
111+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
run: |
113+
gh workflow run release.yml \
114+
--ref "v${{ steps.version.outputs.version }}" \
115+
-f version='${{ steps.version.outputs.version }}' \
116+
-f dry_run='${{ github.event.inputs.dry_run }}'

.github/workflows/release.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,6 @@ jobs:
8888
- uses: dtolnay/rust-toolchain@stable
8989
- uses: Swatinem/rust-cache@v2
9090

91-
- name: Set workspace versions
92-
shell: bash
93-
run: |
94-
VERSION='${{ needs.resolve.outputs.version }}'
95-
sed -i 's/^version = "[^"]*"/version = "'"$VERSION"'"/' reference/PCF-v1.0/Cargo.toml
96-
sed -i 's/^version = "[^"]*"/version = "'"$VERSION"'"/' reference/PFS-MS-v1.0/Cargo.toml
97-
sed -i 's/^version = "[^"]*"/version = "'"$VERSION"'"/' tools/pcf-debug/Cargo.toml
98-
sed -i 's/pcf = { path = "\.\.\/PCF-v1.0", version = "[^"]*" }/pcf = { path = "..\/PCF-v1.0", version = "'"$VERSION"'" }/' reference/PFS-MS-v1.0/Cargo.toml
99-
sed -i 's/pcf = { path = "\.\.\/\.\.\/reference\/PCF-v1.0", version = "[^"]*" }/pcf = { path = "..\/..\/reference\/PCF-v1.0", version = "'"$VERSION"'" }/' tools/pcf-debug/Cargo.toml
100-
10191
- name: Authenticate with crates.io (OIDC trusted publishing)
10292
id: cargo-auth
10393
if: needs.resolve.outputs.dry_run != 'true'
@@ -160,8 +150,6 @@ jobs:
160150
run: npm install -g npm@latest
161151
- run: npm ci
162152
- run: npm run build
163-
- name: Set version
164-
run: npm version '${{ needs.resolve.outputs.version }}' --no-git-tag-version --allow-same-version
165153
- name: npm publish (OIDC trusted publishing, auto-provenance)
166154
run: |
167155
if [ "${{ needs.resolve.outputs.dry_run }}" = "true" ]; then

implementations/dotnet/src/Pcf/Pcf.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Description>Reader/writer for the Partitioned Container Format (PCF) v1.0.</Description>
1212

1313
<PackageId>KDuma.Pcf</PackageId>
14-
<Version>1.0.0</Version>
14+
<Version>0.0.1</Version>
1515
<Authors>Krystian Duma</Authors>
1616
<Company>kduma-OSS</Company>
1717
<Product>Partitioned Container Format</Product>

implementations/ts/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

implementations/ts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kduma-oss/pcf",
3-
"version": "1.0.0",
3+
"version": "0.0.1",
44
"description": "TypeScript implementation of the Partitioned Container Format (PCF) v1.0",
55
"license": "MIT OR Apache-2.0",
66
"author": "Krystian Duma",

reference/PCF-v1.0/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pcf"
3-
version = "1.0.0"
3+
version = "0.0.1"
44
edition = "2021"
55
description = "Reference implementation of the Partitioned Container Format (PCF) v1.0"
66
license = "MIT OR Apache-2.0"

reference/PFS-MS-v1.0/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pfs-ms"
3-
version = "1.0.0"
3+
version = "0.0.1"
44
edition = "2021"
55
description = "Reference implementation of PFS-MS v1.0, the PCF File System Multi-Session profile"
66
license = "MIT OR Apache-2.0"
@@ -21,7 +21,7 @@ path = "src/bin/pfs.rs"
2121
[dependencies]
2222
# The PFS-MS profile is layered strictly above PCF v1.0; every byte container
2323
# operation goes through the reference PCF crate.
24-
pcf = { path = "../PCF-v1.0", version = "1.0.0" }
24+
pcf = { path = "../PCF-v1.0", version = "0.0.1" }
2525

2626
# VCDIFF (RFC 3284) is the required delta algorithm (patch_algo_id = 1).
2727
# `oxidelta` is a pure-Rust encoder/decoder; default features (CLI, file-io,

tools/pcf-debug/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pcf-debug"
3-
version = "0.1.0"
3+
version = "0.0.1"
44
edition = "2021"
55
rust-version = "1.75"
66
license = "MIT OR Apache-2.0"
@@ -16,4 +16,4 @@ name = "pcf-debug"
1616
path = "src/main.rs"
1717

1818
[dependencies]
19-
pcf = { path = "../../reference/PCF-v1.0", version = "1.0.0" }
19+
pcf = { path = "../../reference/PCF-v1.0", version = "0.0.1" }

0 commit comments

Comments
 (0)