Skip to content

Commit b294c00

Browse files
committed
just: add Justfile to automate releasing
Much more turnkey than before!
1 parent 1033ccc commit b294c00

File tree

2 files changed

+48
-5
lines changed

2 files changed

+48
-5
lines changed

Justfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Download release artifacts from GitHub Actions
2+
release-download-distributions token commit:
3+
mkdir -p dist
4+
cargo run --release -- fetch-release-distributions --token {{token}} --commit {{commit}} --dest dist
5+
6+
# Perform local builds for macOS
7+
release-build-macos tag:
8+
#!/bin/bash
9+
set -exo pipefail
10+
11+
export PATH=~/.pyenv/shims:$PATH
12+
13+
rm -rf build dist
14+
git checkout {{tag}}
15+
./build-macos.py --python cpython-3.8 --optimizations pgo
16+
./build-macos.py --python cpython-3.8 --optimizations pgo+lto
17+
./build-macos.py --python cpython-3.9 --optimizations pgo
18+
./build-macos.py --python cpython-3.9 --optimizations pgo+lto
19+
./build-macos.py --python cpython-3.10 --optimizations pgo
20+
./build-macos.py --python cpython-3.10 --optimizations pgo+lto
21+
22+
# Trigger builds of aarch64-apple-darwin release artifacts.
23+
release-build-macos-remote tag:
24+
ssh macmini just --working-directory /Users/gps/src/python-build-standalone --justfile /Users/gps/src/python-build-standalone/Justfile release-build-macos tag={{tag}}
25+
mkdir -p dist
26+
scp 'macmini:~/src/python-build-standalone/dist/*.zst' dist/
27+
cargo run --release -- convert-install-only dist/cpython-*-aarch64-apple-darwin-pgo+lto*.zst
28+
29+
# Upload release artifacts to a GitHub release.
30+
release-upload-distributions token datetime tag:
31+
cargo run --release -- upload-release-distributions --token {{token}} --datetime {{datetime}} --tag {{tag}} --dist dist
32+
33+
# Perform a release.
34+
release token commit tag:
35+
#!/bin/bash
36+
set -eo pipefail
37+
38+
rm -rf dist
39+
just release-download-distributions {{token}} {{commit}}
40+
just release-build-macos-remote {{tag}}
41+
datetime=$(ls dist/cpython-3.10.*-x86_64-unknown-linux-gnu-install_only-*.tar.gz | awk -F- '{print $8}' | awk -F. '{print $1}')
42+
just release-upload-distributions {{token}} ${datetime} {{tag}}

src/main.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ fn main_impl() -> Result<()> {
7676
Arg::new("path")
7777
.required(true)
7878
.takes_value(true)
79+
.multiple_occurrences(true)
7980
.help("Path of archive to convert"),
8081
),
8182
);
@@ -164,11 +165,11 @@ fn main_impl() -> Result<()> {
164165

165166
match matches.subcommand() {
166167
Some(("convert-install-only", args)) => {
167-
let path = args.value_of("path").expect("path argument is required");
168-
169-
let dest_path =
170-
crate::release::produce_install_only(std::path::PathBuf::from(path).as_path())?;
171-
println!("wrote {}", dest_path.display());
168+
for path in args.values_of("path").unwrap() {
169+
let dest_path =
170+
crate::release::produce_install_only(std::path::PathBuf::from(path).as_path())?;
171+
println!("wrote {}", dest_path.display());
172+
}
172173

173174
Ok(())
174175
}

0 commit comments

Comments
 (0)