Also publish nightly binaries with Git commit ID

This makes it possible for users to pin to specific commits for their nightly builds
This commit is contained in:
Armel Soro
2024-06-14 12:11:27 +02:00
parent 6d83e4043b
commit 3d77fe9d2b
2 changed files with 93 additions and 2 deletions

View File

@@ -80,27 +80,38 @@ jobs:
with:
go-version-file: 'go.mod'
- name: Get commit ID
run: |
sha=$(git describe --no-match --always --abbrev=9 --dirty --broken 2>/dev/null || git rev-parse --short HEAD 2>/dev/null)
echo "SHORT_SHA=${sha}" >> "$GITHUB_ENV"
- name: Cross-compile
env:
PROJECT: "github.com/redhat-developer/odo"
RELEASE_SEGMENT_WRITE_KEY: ${{ secrets.RELEASE_SEGMENT_WRITE_KEY }}
run: |
version="$(git describe --no-match --always --abbrev=9 --dirty --broken 2>/dev/null || git rev-parse --short HEAD 2>/dev/null)-nightly"
binName="odo-$GOOS-$GOARCH"
version="${{ env.SHORT_SHA }}-nightly"
binNameNoExt="odo-$GOOS-$GOARCH"
binName="${binNameNoExt}"
binNameWithSha="${binNameNoExt}-${{ env.SHORT_SHA }}"
if [ $GOOS == "windows" ]; then
binName="${binName}.exe"
binNameWithSha="${binNameWithSha}.exe"
fi
go build -o "$binName" \
-mod=vendor \
-ldflags="-s -w -X ${PROJECT}/pkg/segment.writeKey=${RELEASE_SEGMENT_WRITE_KEY} -X ${PROJECT}/pkg/version.GITCOMMIT=${version}" \
./cmd/odo/
cp -vr "$binName" "${binNameWithSha}"
- name: Generate archive
run: |
if [ $GOOS == "windows" ]; then
zip -9 -y -r -q "odo-${GOOS}-${GOARCH}.zip" "odo-${GOOS}-${GOARCH}.exe"
zip -9 -y -r -q "odo-${GOOS}-${GOARCH}-${{ env.SHORT_SHA }}.zip" "odo-${GOOS}-${GOARCH}-${{ env.SHORT_SHA }}.exe"
else
tar -czvf "odo-${GOOS}-${GOARCH}.tar.gz" "odo-${GOOS}-${GOARCH}"
tar -czvf "odo-${GOOS}-${GOARCH}-${{ env.SHORT_SHA }}.tar.gz" "odo-${GOOS}-${GOARCH}-${{ env.SHORT_SHA }}"
fi
- name: Generate SHA-256 checksums

View File

@@ -369,12 +369,23 @@ Installing `odo` on `amd64` architecture:
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-linux-amd64 -o odo
```
To download a specific commit instead, run:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-linux-amd64-${gitCommitId} -o odo
```
2. (Recommended) Verify the downloaded binary with the SHA-256 sum:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-linux-amd64.sha256 -o odo.sha256
echo "$(<odo.sha256) odo" | shasum -a 256 --check
```
To verify a download for a specific commit instead, run:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-linux-amd64-${gitCommitId}.sha256 -o odo.sha256
echo "$(<odo.sha256) odo" | shasum -a 256 --check
```
3. Install odo:
```shell
sudo install -o root -g root -m 0755 odo /usr/local/bin/odo
@@ -400,12 +411,23 @@ Installing `odo` on `arm64` architecture:
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-linux-arm64 -o odo
```
To download a specific commit instead, run:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-linux-arm64-${gitCommitId} -o odo
```
2. (Recommended) Verify the downloaded binary with the SHA-256 sum:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-linux-arm64.sha256 -o odo.sha256
echo "$(<odo.sha256) odo" | shasum -a 256 --check
```
To verify a download for a specific commit instead, run:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-linux-arm64-${gitCommitId}.sha256 -o odo.sha256
echo "$(<odo.sha256) odo" | shasum -a 256 --check
```
3. Install odo:
```shell
sudo install -o root -g root -m 0755 odo /usr/local/bin/odo
@@ -431,12 +453,23 @@ Installing `odo` on `ppc64le` architecture:
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-linux-ppc64le -o odo
```
To download a specific commit instead, run:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-linux-ppc64le-${gitCommitId} -o odo
```
2. (Recommended) Verify the downloaded binary with the SHA-256 sum:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-linux-ppc64le.sha256 -o odo.sha256
echo "$(<odo.sha256) odo" | shasum -a 256 --check
```
To verify a download for a specific commit instead, run:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-linux-ppc64le-${gitCommitId}.sha256 -o odo.sha256
echo "$(<odo.sha256) odo" | shasum -a 256 --check
```
3. Install odo:
```shell
sudo install -o root -g root -m 0755 odo /usr/local/bin/odo
@@ -462,12 +495,23 @@ Installing `odo` on `s390x` architecture:
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-linux-s390x -o odo
```
To download a specific commit instead, run:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-linux-s390x-${gitCommitId} -o odo
```
2. (Recommended) Verify the downloaded binary with the SHA-256 sum:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-linux-s390x.sha256 -o odo.sha256
echo "$(<odo.sha256) odo" | shasum -a 256 --check
```
To verify a download for a specific commit instead, run:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-linux-s390x-${gitCommitId}.sha256 -o odo.sha256
echo "$(<odo.sha256) odo" | shasum -a 256 --check
```
3. Install odo:
```shell
sudo install -o root -g root -m 0755 odo /usr/local/bin/odo
@@ -506,12 +550,23 @@ Installing `odo` on `amd64` architecture:
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-darwin-amd64 -o odo
```
To download a specific commit instead, run:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-darwin-amd64-${gitCommitId} -o odo
```
2. (Recommended) Verify the downloaded binary with the SHA-256 sum:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-darwin-amd64.sha256 -o odo.sha256
echo "$(<odo.sha256) odo" | shasum -a 256 --check
```
To verify a download for a specific commit instead, run:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-darwin-amd64-${gitCommitId}.sha256 -o odo.sha256
echo "$(<odo.sha256) odo" | shasum -a 256 --check
```
3. Install odo:
```shell
chmod +x ./odo
@@ -538,12 +593,23 @@ Installing `odo` on `arm64` architecture:
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-darwin-arm64 -o odo
```
To download a specific commit instead, run:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-darwin-arm64-${gitCommitId} -o odo
```
2. (Recommended) Verify the downloaded binary with the SHA-256 sum:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-darwin-arm64.sha256 -o odo.sha256
echo "$(<odo.sha256) odo" | shasum -a 256 --check
```
To verify a download for a specific commit instead, run:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-darwin-arm64-${gitCommitId}.sha256 -o odo.sha256
echo "$(<odo.sha256) odo" | shasum -a 256 --check
```
3. Install odo:
```shell
chmod +x ./odo
@@ -574,6 +640,12 @@ echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-windows-amd64.exe -o odo.exe
```
To download a specific commit instead, run:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-windows-amd64-${gitCommitId}.exe -o odo.exe
```
3. (Recommended) Verify the downloaded binary with the SHA-256 sum:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-windows-amd64.exe.sha256 -o odo.exe.sha256
@@ -582,4 +654,12 @@ Get-FileHash odo.exe
type odo.exe.sha256
```
To verify a download for a specific commit instead, run:
```shell
curl -L https://s3.eu-de.cloud-object-storage.appdomain.cloud/odo-nightly-builds/odo-windows-amd64-${gitCommitId}.exe.sha256 -o odo.exe.sha256
# Visually compare the output of both files
Get-FileHash odo.exe
type odo.exe.sha256
```
4. Add the binary to your `PATH`