build: Add "upload" build step
This commit is contained in:
parent
a3ffe51ddf
commit
5f1657484f
|
|
@ -1 +1,4 @@
|
||||||
target
|
target
|
||||||
|
scripts
|
||||||
|
debian
|
||||||
|
systemd
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ versions which follow [Semantic Versioning][semver].
|
||||||
|
|
||||||
## Format
|
## Format
|
||||||
|
|
||||||
Versioning of the Radicle Stack is based on Git tags. During the build phase
|
Versioning of the Radicle Stack is based on Git tags. During the build phase,
|
||||||
(`build.rs`), we search for the most recent tag that starts with a `v`
|
we search for the most recent tag that starts with a `v` character, eg.
|
||||||
character, eg. `v1.0.0`, and use that as the basis for computing the version.
|
`v1.0.0`, and use that as the basis for computing the version.
|
||||||
|
|
||||||
If we're building code that is pointed to by that tag directly, that code will
|
If we're building code that is pointed to by that tag directly, that code will
|
||||||
inherit that version number, with the `v` character stripped. For example:
|
inherit that version number, with the `v` character stripped. For example:
|
||||||
|
|
@ -19,12 +19,11 @@ inherit that version number, with the `v` character stripped. For example:
|
||||||
1.0.0
|
1.0.0
|
||||||
|
|
||||||
If on the other hand, the commit we are building has no version tag pointing to
|
If on the other hand, the commit we are building has no version tag pointing to
|
||||||
it, we will use the most recent version tag by walking the history backwards
|
it, the output of `git describe` is used as-is. This indicates a development
|
||||||
until we hit a tagged commit, and suffixing the version number with `-dev`,
|
version that is not released and not meant to be packaged or distributed. For
|
||||||
plus the short hash of the commit. This indicates a development version that is
|
example:
|
||||||
not released and not meant to be packaged or distributed. For example:
|
|
||||||
|
|
||||||
1.0.0-dev+5a3cd6d
|
1.0.0-6-ga3ffe51d
|
||||||
|
|
||||||
Tags used for versioning are always annotated and signed, and follow the format:
|
Tags used for versioning are always annotated and signed, and follow the format:
|
||||||
|
|
||||||
|
|
@ -40,7 +39,7 @@ For example:
|
||||||
|
|
||||||
1.0.0-rc.2
|
1.0.0-rc.2
|
||||||
|
|
||||||
These releases are meant to be packaged (they don't have `-dev` in them).
|
These releases are meant to be packaged.
|
||||||
|
|
||||||
## Semantics
|
## Semantics
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ COPY --from=builder /src/*.1 /builds/x86_64-apple-darwin/man/man1/
|
||||||
|
|
||||||
# Create and compress reproducible archive.
|
# Create and compress reproducible archive.
|
||||||
WORKDIR /builds
|
WORKDIR /builds
|
||||||
|
RUN x86_64-unknown-linux-musl/bin/rad version --json > radicle.json
|
||||||
RUN apk update && apk add --no-cache tar xz
|
RUN apk update && apk add --no-cache tar xz
|
||||||
RUN find * -maxdepth 0 -type d -exec mv '{}' "radicle-$RADICLE_VERSION-{}" \; && \
|
RUN find * -maxdepth 0 -type d -exec mv '{}' "radicle-$RADICLE_VERSION-{}" \; && \
|
||||||
find * -maxdepth 0 -type d -exec tar \
|
find * -maxdepth 0 -type d -exec tar \
|
||||||
|
|
@ -107,6 +108,7 @@ RUN find * -maxdepth 0 -type d -exec mv '{}' "radicle-$RADICLE_VERSION-{}" \; &&
|
||||||
--format=posix \
|
--format=posix \
|
||||||
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
|
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
|
||||||
--mode='go+u,go-w' \
|
--mode='go+u,go-w' \
|
||||||
|
--remove-files \
|
||||||
--create --xz \
|
--create --xz \
|
||||||
--file="{}.tar.xz" \
|
--file="{}.tar.xz" \
|
||||||
'{}' \;
|
'{}' \;
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,7 @@ main() {
|
||||||
tempdir="$(mktemp -d)"
|
tempdir="$(mktemp -d)"
|
||||||
gitarchive="$tempdir/heartwood-$rev.tar.gz"
|
gitarchive="$tempdir/heartwood-$rev.tar.gz"
|
||||||
keypath="$(rad path)/keys/radicle.pub"
|
keypath="$(rad path)/keys/radicle.pub"
|
||||||
|
version="$(build/version.sh)"
|
||||||
if ! version="$(git describe --match='v*' --candidates=1 2>/dev/null)"; then
|
|
||||||
echo "fatal: no version tag found by 'git describe'" ; exit 1
|
|
||||||
fi
|
|
||||||
# Remove `v` prefix from version.
|
|
||||||
version=${version#v}
|
|
||||||
image=radicle-build-$version
|
image=radicle-build-$version
|
||||||
|
|
||||||
if [ ! -f "$keypath" ]; then
|
if [ ! -f "$keypath" ]; then
|
||||||
|
|
@ -54,25 +49,17 @@ main() {
|
||||||
echo "Creating container (radicle-build-container).."
|
echo "Creating container (radicle-build-container).."
|
||||||
podman --cgroup-manager=cgroupfs create --replace --name radicle-build-container $image
|
podman --cgroup-manager=cgroupfs create --replace --name radicle-build-container $image
|
||||||
|
|
||||||
targets="\
|
# Copy build artifacts to output folder.
|
||||||
x86_64-unknown-linux-musl \
|
outdir=build/artifacts/
|
||||||
aarch64-unknown-linux-musl \
|
mkdir -p $outdir
|
||||||
x86_64-apple-darwin \
|
podman cp --overwrite radicle-build-container:/builds/. $outdir
|
||||||
aarch64-apple-darwin"
|
|
||||||
|
|
||||||
for target in $targets; do
|
for target in $(cat build/targets); do
|
||||||
outdir=build/artifacts/$target
|
echo "Signing artifacts for $target.."
|
||||||
|
|
||||||
echo "Copying artifacts for $target.."
|
|
||||||
mkdir -p $outdir
|
|
||||||
rm -rf $outdir/*
|
|
||||||
|
|
||||||
filename="radicle-$version-$target.tar.xz"
|
filename="radicle-$version-$target.tar.xz"
|
||||||
filepath="$outdir/$filename"
|
filepath="$outdir/$filename"
|
||||||
|
|
||||||
# Copy archive to target folder.
|
|
||||||
podman cp radicle-build-container:/builds/$filename $outdir
|
|
||||||
|
|
||||||
# Output SHA256 digest of archive.
|
# Output SHA256 digest of archive.
|
||||||
checksum="$(cd $outdir && sha256sum $filename)"
|
checksum="$(cd $outdir && sha256sum $filename)"
|
||||||
echo "Checksum of $filepath is $(echo "$checksum" | cut -d' ' -f1)"
|
echo "Checksum of $filepath is $(echo "$checksum" | cut -d' ' -f1)"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
x86_64-unknown-linux-musl
|
||||||
|
aarch64-unknown-linux-musl
|
||||||
|
x86_64-apple-darwin
|
||||||
|
aarch64-apple-darwin
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SSH_LOGIN=${SSH_LOGIN:-release}
|
||||||
|
SSH_ADDRESS=${SSH_ADDRESS:-$SSH_LOGIN@files.radicle.xyz}
|
||||||
|
SSH_KEY="$(rad path)/keys/radicle"
|
||||||
|
|
||||||
|
main() {
|
||||||
|
version="$(build/version.sh)"
|
||||||
|
|
||||||
|
echo "Uploading Radicle $version..."
|
||||||
|
|
||||||
|
if [ -z "$version" ]; then
|
||||||
|
echo "fatal: empty version number" >&2 ; exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create remote folder.
|
||||||
|
ssh -i $SSH_KEY $SSH_ADDRESS mkdir -p /mnt/radicle/files/releases/$version
|
||||||
|
# Copy files over.
|
||||||
|
scp -i $SSH_KEY build/artifacts/radicle-$version* $SSH_ADDRESS:/mnt/radicle/files/releases/$version
|
||||||
|
scp -i $SSH_KEY build/artifacts/radicle.json $SSH_ADDRESS:/mnt/radicle/files/releases/$version
|
||||||
|
|
||||||
|
for target in $(cat build/targets); do
|
||||||
|
archive=/mnt/radicle/files/releases/$version/radicle-$version-$target.tar.xz
|
||||||
|
symlink=/mnt/radicle/files/releases/$version/radicle-$target.tar.xz
|
||||||
|
|
||||||
|
echo "Creating symlinks for $target.."
|
||||||
|
|
||||||
|
ssh -i $SSH_KEY $SSH_ADDRESS ln -snf $archive $symlink
|
||||||
|
ssh -i $SSH_KEY $SSH_ADDRESS ln -snf $archive.sig $symlink.sig
|
||||||
|
ssh -i $SSH_KEY $SSH_ADDRESS ln -snf $archive.sha256 $symlink.sha256
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Creating 'latest' symlink.."
|
||||||
|
ssh -i $SSH_KEY $SSH_ADDRESS ln -snf /mnt/radicle/files/releases/$version /mnt/radicle/files/releases/latest
|
||||||
|
echo "Done."
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if ! version="$(git describe --match='v*' --candidates=1 2>/dev/null)"; then
|
||||||
|
echo "fatal: no version tag found by 'git describe'" >&2 ; exit 1
|
||||||
|
fi
|
||||||
|
# Remove `v` prefix from version.
|
||||||
|
version=${version#v}
|
||||||
|
|
||||||
|
echo $version
|
||||||
Loading…
Reference in New Issue