2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-22 02:48:55 +00:00

bump version numbers in instructions to reproduce binaries

This commit is contained in:
Michael Eischer 2022-11-26 12:08:31 +01:00
parent a1eb923876
commit 8ad231bcad

View File

@ -23,17 +23,17 @@ timestamp and filename of the binary contained in it. In order to reproduce the
exact same ZIP file every time, we update the timestamp of the file ``VERSION``
in the source code archive and set the timezone to Europe/Berlin.
In the following example, we'll use the file ``restic-0.12.1.tar.gz`` and Go
1.16.6 to reproduce the released binaries.
In the following example, we'll use the file ``restic-0.14.0.tar.gz`` and Go
1.19 to reproduce the released binaries.
1. Determine the Go compiler version used to build the released binaries, then download and extract the Go compiler into ``/usr/local/go``:
.. code::
$ restic version
restic 0.12.1 compiled with go1.16.6 on linux/amd64
restic 0.14.0 compiled with go1.19 on linux/amd64
$ cd /usr/local
$ curl -L https://dl.google.com/go/go1.16.6.linux-amd64.tar.gz | tar xz
$ curl -L https://dl.google.com/go/go1.19.linux-amd64.tar.gz | tar xz
2. Extract the restic source code into ``/restic``
@ -41,7 +41,7 @@ In the following example, we'll use the file ``restic-0.12.1.tar.gz`` and Go
$ mkdir /restic
$ cd /restic
$ TZ=Europe/Berlin curl -L https://github.com/restic/restic/releases/download/v0.12.1/restic-0.12.1.tar.gz | tar xz --strip-components=1
$ TZ=Europe/Berlin curl -L https://github.com/restic/restic/releases/download/v0.14.0/restic-0.14.0.tar.gz | tar xz --strip-components=1
3. Build the binaries for Windows and Linux:
@ -50,14 +50,14 @@ In the following example, we'll use the file ``restic-0.12.1.tar.gz`` and Go
$ export PATH=/usr/local/go/bin:$PATH
$ export GOPATH=/home/build/go
$ go version
go version go1.16.6 linux/amd64
go version go1.19 linux/amd64
$ GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-s -w" -tags selfupdate -o restic_linux_amd64 ./cmd/restic
$ bzip2 restic_linux_amd64
$ GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-s -w" -tags selfupdate -o restic_0.12.1_windows_amd64.exe ./cmd/restic
$ touch --reference VERSION restic_0.12.1_windows_amd64.exe
$ TZ=Europe/Berlin zip -q -X restic_0.12.1_windows_amd64.zip restic_0.12.1_windows_amd64.exe
$ GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-s -w" -tags selfupdate -o restic_0.14.0_windows_amd64.exe ./cmd/restic
$ touch --reference VERSION restic_0.14.0_windows_amd64.exe
$ TZ=Europe/Berlin zip -q -X restic_0.14.0_windows_amd64.zip restic_0.14.0_windows_amd64.exe
Building the Official Binaries
******************************
@ -85,7 +85,7 @@ The following steps are necessary to build the binaries:
.. code::
tar xvzf restic-0.12.1.tar.gz
tar xvzf restic-0.14.0.tar.gz
3. Create a directory to place the resulting binaries in:
@ -98,20 +98,20 @@ The following steps are necessary to build the binaries:
.. code::
docker run --rm \
--volume "$PWD/restic-0.12.1:/restic" \
--volume "$PWD/restic-0.14.0:/restic" \
--volume "$PWD/output:/output" \
restic/builder \
go run helpers/build-release-binaries/main.go --version 0.12.1
go run helpers/build-release-binaries/main.go --version 0.14.0
4. If anything goes wrong, you can enable debug output like this:
.. code::
docker run --rm \
--volume "$PWD/restic-0.12.1:/restic" \
--volume "$PWD/restic-0.14.0:/restic" \
--volume "$PWD/output:/output" \
restic/builder \
go run helpers/build-release-binaries/main.go --version 0.12.1 --verbose
go run helpers/build-release-binaries/main.go --version 0.14.0 --verbose
Prepare a New Release
*********************
@ -124,6 +124,6 @@ required argument is the new version number (in `Semantic Versioning
.. code::
go run helpers/prepare-release/main.go 0.12.1
go run helpers/prepare-release/main.go 0.14.0
Checks can be skipped on demand via flags, please see ``--help`` for details.