Skip to content

Commit 83835db

Browse files
committed
Improve release process
1 parent 7b27f04 commit 83835db

File tree

3 files changed

+115
-30
lines changed

3 files changed

+115
-30
lines changed

README.md

+33
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ cd scrypt-kdf
5858
cargo build --release
5959
```
6060

61+
Depending on whether you are using x64 or arm64, you might need to add either the `x86_64-apple-darwin` or the `aarch64-apple-darwin` target accordingly:
62+
63+
```sh
64+
rustup target add x86_64-apple-darwin
65+
rustup target add aarch64-apple-darwin
66+
```
67+
6168
### Linux x86_x64
6269

6370
In order to get stuff working later, use the `nightly` branch of Rust:
@@ -90,6 +97,32 @@ CROSS_COMPILE=x86_64-linux-musl- cargo build --target=x86_64-unknown-linux-musl
9097
cargo build --target=x86_64-unknown-linux-musl
9198
```
9299

100+
### For Windows
101+
102+
In order to get stuff working later, use the `nightly` branch of Rust:
103+
104+
```sh
105+
rustup override set nightly
106+
```
107+
108+
Install the standard Windows target on a Mac (note, that the opposite is currently impossible):
109+
110+
```sh
111+
rustup target add x86_64-pc-windows-gnu
112+
```
113+
114+
Use `homebrew` to install mingw-w64:
115+
116+
```sh
117+
brew install mingw-w64
118+
```
119+
120+
Now you can build it:
121+
122+
```sh
123+
cargo build --release --target=x86_64-pc-windows-gnu
124+
```
125+
93126
## Example
94127

95128
Let's try to derive the key for the secret `test`, using the salt `salt`:

build.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash -e
1+
#!/usr/bin/env sh -e
22

33
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
44

@@ -11,6 +11,9 @@ cargo clippy --all-targets --all-features -- -D warnings
1111
echo "Running tests..."
1212
cargo test --release
1313

14+
echo "Building v${VERSION} for Mac OS arm64..."
15+
cargo build --release --target=aarch64-apple-darwin
16+
1417
echo "Building v${VERSION} for Mac OS..."
1518
cargo build --release --target=x86_64-apple-darwin
1619

@@ -20,3 +23,6 @@ export CXX_x86_64_unknown_linux_musl=x86_64-unknown-linux-musl-g++
2023
export AR_x86_64_unknown_linux_musl=x86_64-unknown-linux-musl-ar
2124
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=x86_64-unknown-linux-musl-gcc
2225
CROSS_COMPILE=x86_64-linux-musl- cargo build --release --target=x86_64-unknown-linux-musl
26+
27+
echo "Building v${VERSION} for Windows x64..."
28+
cargo build --release --target=x86_64-pc-windows-gnu

release.sh

+75-29
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,107 @@
1-
#!/usr/bin/env bash -e
1+
#!/usr/bin/env sh -e
22

33
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
44

55
./build.sh
66

77
rm -rf target/*.tgz target/*.tgz.sig target/release.md
88

9-
echo "Creating v${VERSION} bundle for Mac OS..."
10-
APPLE_TARGET="scrypt-kdf-${VERSION}-osx.tgz"
11-
APPLE_TARGET_SIG=${APPLE_TARGET}.sig
12-
APPLE_RELEASE="target/${APPLE_TARGET}"
13-
APPLE_RELEASE_SIG=${APPLE_RELEASE}.sig
14-
tar zcvf ${APPLE_RELEASE} target/x86_64-apple-darwin/release/scrypt-kdf
15-
APPLE_RELEASE_SHA512=$(shasum -a512 ${APPLE_RELEASE})
16-
gpg --output ${APPLE_RELEASE_SIG} --detach-sig ${APPLE_RELEASE}
9+
echo "Creating v${VERSION} bundle for Mac OS ARM64..."
10+
APPLE_ARM64_TARGET="scrypt-kdf-${VERSION}-osx-arm64.tgz"
11+
APPLE_ARM64_TARGET_SIG=${APPLE_ARM64_TARGET}.sig
12+
APPLE_ARM64_RELEASE="target/${APPLE_ARM64_TARGET}"
13+
APPLE_ARM64_RELEASE_SIG=${APPLE_ARM64_RELEASE}.sig
14+
tar zcvf ${APPLE_ARM64_RELEASE} target/aarch64-apple-darwin/release/scrypt-kdf
15+
APPLE_ARM64_RELEASE_SHA512=$(shasum -a512 ${APPLE_ARM64_RELEASE})
16+
gpg --output ${APPLE_ARM64_RELEASE_SIG} --detach-sig ${APPLE_ARM64_RELEASE}
17+
18+
echo "Creating v${VERSION} bundle for Mac OS x64..."
19+
APPLE_X64_TARGET="scrypt-kdf-${VERSION}-osx-x64.tgz"
20+
APPLE_X64_TARGET_SIG=${APPLE_X64_TARGET}.sig
21+
APPLE_X64_RELEASE="target/${APPLE_X64_TARGET}"
22+
APPLE_X64_RELEASE_SIG=${APPLE_X64_RELEASE}.sig
23+
tar zcvf ${APPLE_X64_RELEASE} target/x86_64-apple-darwin/release/scrypt-kdf
24+
APPLE_X64_RELEASE_SHA512=$(shasum -a512 ${APPLE_X64_RELEASE})
25+
gpg --output ${APPLE_X64_RELEASE_SIG} --detach-sig ${APPLE_X64_RELEASE}
1726

1827
echo "Creating v${VERSION} bundle for Linux AMD64..."
19-
LINUX_TARGET="scrypt-kdf-${VERSION}-linux-amd64.tgz"
20-
LINUX_TARGET_SIG=${LINUX_TARGET}.sig
21-
LINUX_RELEASE="target/${LINUX_TARGET}"
22-
LINUX_RELEASE_SIG=${LINUX_RELEASE}.sig
23-
tar zcvf ${LINUX_RELEASE} target/x86_64-unknown-linux-musl/release/scrypt-kdf
24-
LINUX_RELEASE_SHA512=$(shasum -a512 ${LINUX_RELEASE})
25-
gpg --output ${LINUX_RELEASE_SIG} --detach-sig ${LINUX_RELEASE}
28+
LINUX_AMD64_TARGET="scrypt-kdf-${VERSION}-linux-amd64.tgz"
29+
LINUX_AMD64_TARGET_SIG=${LINUX_AMD64_TARGET}.sig
30+
LINUX_AMD64_RELEASE="target/${LINUX_AMD64_TARGET}"
31+
LINUX_AMD64_RELEASE_SIG=${LINUX_AMD64_RELEASE}.sig
32+
tar zcvf ${LINUX_AMD64_RELEASE} target/x86_64-unknown-linux-musl/release/scrypt-kdf
33+
LINUX_AMD64_RELEASE_SHA512=$(shasum -a512 ${LINUX_AMD64_RELEASE})
34+
gpg --output ${LINUX_AMD64_RELEASE_SIG} --detach-sig ${LINUX_AMD64_RELEASE}
35+
36+
echo "Creating v${VERSION} bundle for Windows x64..."
37+
WINDOWS_X64_TARGET="scrypt-kdf-${VERSION}-windows-amd64.tgz"
38+
WINDOWS_X64_TARGET_SIG=${WINDOWS_X64_TARGET}.sig
39+
WINDOWS_X64_RELEASE="target/${WINDOWS_X64_TARGET}"
40+
WINDOWS_X64_RELEASE_SIG=${WINDOWS_X64_RELEASE}.sig
41+
tar zcvf ${WINDOWS_X64_RELEASE} target/x86_64-pc-windows-gnu/release/scrypt-kdf.exe
42+
WINDOWS_X64_RELEASE_SHA512=$(shasum -a512 ${WINDOWS_X64_RELEASE})
43+
gpg --output ${WINDOWS_X64_RELEASE_SIG} --detach-sig ${WINDOWS_X64_RELEASE}
2644

2745
RELEASE_NOTES="target/release.md"
2846
echo "Preparing release notes..."
2947

3048
cat <<EOF >$RELEASE_NOTES
3149
# Release Notes v${VERSION}
3250
33-
## Mac OS
51+
## Mac OS ARM64
3452
35-
### SHA512
53+
Calculate the SHA512:
3654
37-
\`\`\`bash
38-
shasum -a512 ${APPLE_RELEASE} ${APPLE_RELEASE_SHA512}
55+
\`\`\`sh
56+
shasum -a512 ${APPLE_ARM64_RELEASE} ${APPLE_ARM64_RELEASE_SHA512}
3957
\`\`\`
4058
41-
### Digital Signature
59+
Verify the digital signature:
4260
43-
\`\`\`bash
44-
gpg --verify ${APPLE_TARGET_SIG} ${APPLE_TARGET}
61+
\`\`\`sh
62+
gpg --verify ${APPLE_ARM64_TARGET_SIG} ${APPLE_ARM64_TARGET}
63+
\`\`\`
64+
65+
## Mac OS x64
66+
67+
Calculate the SHA512:
68+
69+
\`\`\`sh
70+
shasum -a512 ${APPLE_X64_RELEASE} ${APPLE_X64_RELEASE_SHA512}
71+
\`\`\`
72+
73+
Verify the digital signature:
74+
75+
\`\`\`sh
76+
gpg --verify ${APPLE_X64_TARGET_SIG} ${APPLE_X64_TARGET}
4577
\`\`\`
4678
4779
## Linux AMD64
4880
49-
### SHA512
81+
Calculate the SHA512:
82+
83+
\`\`\`sh
84+
shasum -a512 ${LINUX_AMD64_RELEASE} ${LINUX_AMD64_RELEASE_SHA512}
85+
\`\`\`
86+
87+
Verify the digital signature:
88+
89+
\`\`\`sh
90+
gpg --verify ${LINUX_AMD64_TARGET_SIG} ${LINUX_AMD64_TARGET}
91+
\`\`\`
92+
93+
## Windows x64
94+
95+
Calculate the SHA512:
5096
51-
\`\`\`bash
52-
shasum -a512 ${LINUX_RELEASE} ${LINUX_RELEASE_SHA512}
97+
\`\`\`sh
98+
shasum -a512 ${WINDOWS_X64_RELEASE} ${WINDOWS_X64_RELEASE_SHA512}
5399
\`\`\`
54100
55-
### Digital Signature
101+
Verify the digital signature:
56102
57-
\`\`\`bash
58-
gpg --verify ${LINUX_TARGET_SIG} ${LINUX_TARGET}
103+
\`\`\`sh
104+
gpg --verify ${WINDOWS_X64_TARGET_SIG} ${WINDOWS_X64_TARGET}
59105
\`\`\`
60106
61107
EOF

0 commit comments

Comments
 (0)