Skip to content

Commit 42f500e

Browse files
committed
Fix release job working directory
Simplify the working directory management of the release job. Signed-off-by: Sascha Grunert <[email protected]>
1 parent 5c35c71 commit 42f500e

File tree

3 files changed

+20
-37
lines changed

3 files changed

+20
-37
lines changed

Diff for: .github/workflows/release.yml

+8-25
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,26 @@ jobs:
88
name: release
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/setup-go@v5
12-
with:
13-
go-version: '1.22'
14-
cache: false
15-
16-
- name: Set env
17-
shell: bash
18-
run: |
19-
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
20-
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
21-
- uses: actions/cache@v4
22-
with:
23-
path: |
24-
~/go/pkg/mod
25-
~/.cache/go-build
26-
key: go-release-${{ hashFiles('**/go.sum') }}
27-
restore-keys: go-release-
2811
- uses: actions/checkout@v4
2912
with:
3013
fetch-depth: 0
31-
path: src/github.com/kubernetes-sigs/cri-tools
32-
- run: |
33-
make release-notes release
14+
- uses: actions/setup-go@v5
15+
with:
16+
go-version: '1.22'
17+
- run: make release-notes release
3418
env:
3519
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
36-
working-directory: src/github.com/kubernetes-sigs/cri-tools
3720
- uses: ncipollo/release-action@v1
3821
with:
3922
allowUpdates: true
40-
artifacts: src/github.com/kubernetes-sigs/cri-tools/_output/releases/*
41-
bodyFile: src/github.com/kubernetes-sigs/cri-tools/release-notes.md
23+
artifacts: _output/releases/*
24+
bodyFile: release-notes.md
4225
token: ${{ secrets.GH_TOKEN }}
4326
- uses: actions/upload-artifact@v4
4427
with:
4528
name: release-notes
46-
path: src/github.com/kubernetes-sigs/cri-tools/release-notes.md
29+
path: release-notes.md
4730
- uses: actions/upload-artifact@v4
4831
with:
4932
name: build-artifacts
50-
path: src/github.com/kubernetes-sigs/cri-tools/_output
33+
path: _output

Diff for: hack/release-notes.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ set -euo pipefail
1818

1919
BUILD_DIR=build
2020
BINARY=$BUILD_DIR/release-notes
21-
VERSION=v0.16.8
21+
VERSION=v0.17.2
2222

2323
mkdir -p $BUILD_DIR
2424
curl -sSfL --retry 5 --retry-delay 10 -o $BINARY \

Diff for: hack/release.sh

+11-11
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ CRI_TEST_PLATFORMS=(
4747

4848
# Create releases output directory.
4949
PROJECT="sigs.k8s.io/cri-tools"
50-
CRI_TOOLS_ROOT="$GOPATH/src/$PROJECT"
51-
OUTPUTDIR=$CRI_TOOLS_ROOT/_output/releases
52-
mkdir -p "$OUTPUTDIR"
50+
OUTPUT_DIR=_output
51+
RELEASES_DIR=$OUTPUT_DIR/releases
52+
mkdir -p "$RELEASES_DIR"
5353

5454
GO_LDFLAGS="-X ${PROJECT}/pkg/version.Version=${VERSION}"
5555

@@ -63,14 +63,14 @@ for platform in "${CRI_CTL_PLATFORMS[@]}"; do
6363
CRICTL_BIN="crictl.exe"
6464
fi
6565

66-
output_bin=${CRI_TOOLS_ROOT}/_output/bin/$arch-$os/${CRICTL_BIN}
66+
output_bin=$OUTPUT_DIR/bin/$arch-$os/${CRICTL_BIN}
6767
GOARCH="$arch" GOOS="$os" CGO_ENABLED=0 go build \
6868
-o ${output_bin} \
6969
-ldflags "${GO_LDFLAGS}" \
7070
${PROJECT}/cmd/crictl
7171
file ${output_bin}
72-
tar zcf "$OUTPUTDIR/crictl-$VERSION-$os-$arch.tar.gz" \
73-
-C ${CRI_TOOLS_ROOT}/_output/bin/$arch-$os \
72+
tar zcf "$RELEASES_DIR/crictl-$VERSION-$os-$arch.tar.gz" \
73+
-C $OUTPUT_DIR/bin/$arch-$os \
7474
${CRICTL_BIN}
7575
done
7676

@@ -84,14 +84,14 @@ for platform in "${CRI_TEST_PLATFORMS[@]}"; do
8484
CRITEST_BIN="critest.exe"
8585
fi
8686

87-
output_bin=${CRI_TOOLS_ROOT}/_output/bin/$arch-$os/${CRITEST_BIN}
87+
output_bin=$OUTPUT_DIR/bin/$arch-$os/${CRITEST_BIN}
8888
GOARCH="$arch" GOOS="$os" CGO_ENABLED=0 go test -c \
8989
-o ${output_bin} \
9090
-ldflags "${GO_LDFLAGS}" \
9191
${PROJECT}/cmd/critest
9292
file ${output_bin}
93-
tar zcf "$OUTPUTDIR/critest-$VERSION-$os-$arch.tar.gz" \
94-
-C ${CRI_TOOLS_ROOT}/_output/bin/$arch-$os \
93+
tar zcf "$RELEASES_DIR/critest-$VERSION-$os-$arch.tar.gz" \
94+
-C $OUTPUT_DIR/bin/$arch-$os \
9595
${CRITEST_BIN}
9696
done
9797

@@ -101,14 +101,14 @@ echo "| ---- | ------ | ------" | tee -a release-notes.md
101101

102102
# Show sha256/512 for release files
103103
if [[ "${OSTYPE}" == "darwin"* ]]; then
104-
for file in "$OUTPUTDIR"/*.tar.gz; do
104+
for file in "$RELEASES_DIR"/*.tar.gz; do
105105
SHA256=$(shasum -a 256 "$file" | sed -e "s,$file,," | awk '{print $1}' | tee "$file.sha256")
106106
SHA512=$(shasum -a 512 "$file" | sed -e "s,$file,," | awk '{print $1}' | tee "$file.sha512")
107107
BASE=$(basename "$file")
108108
echo "| $BASE | $SHA256 | $SHA512 |" | tee -a release-notes.md
109109
done
110110
else
111-
for file in "$OUTPUTDIR"/*.tar.gz; do
111+
for file in "$RELEASES_DIR"/*.tar.gz; do
112112
SHA256=$(sha256sum -b "$file" | sed -e "s,$file,," | awk '{print $1}' | tee "$file.sha256")
113113
SHA512=$(sha512sum -b "$file" | sed -e "s,$file,," | awk '{print $1}' | tee "$file.sha512")
114114
BASE=$(basename "$file")

0 commit comments

Comments
 (0)