Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.31] Fix release job working directory #1569

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 8 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,26 @@ jobs:
name: release
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: false

- name: Set env
shell: bash
run: |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: go-release-${{ hashFiles('**/go.sum') }}
restore-keys: go-release-
- uses: actions/checkout@v4
with:
fetch-depth: 0
path: src/github.com/kubernetes-sigs/cri-tools
- run: |
make release-notes release
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- run: make release-notes release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
working-directory: src/github.com/kubernetes-sigs/cri-tools
- uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: src/github.com/kubernetes-sigs/cri-tools/_output/releases/*
bodyFile: src/github.com/kubernetes-sigs/cri-tools/release-notes.md
artifacts: _output/releases/*
bodyFile: release-notes.md
token: ${{ secrets.GH_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: release-notes
path: src/github.com/kubernetes-sigs/cri-tools/release-notes.md
path: release-notes.md
- uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: src/github.com/kubernetes-sigs/cri-tools/_output
path: _output
2 changes: 1 addition & 1 deletion hack/release-notes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -euo pipefail

BUILD_DIR=build
BINARY=$BUILD_DIR/release-notes
VERSION=v0.16.8
VERSION=v0.17.2

mkdir -p $BUILD_DIR
curl -sSfL --retry 5 --retry-delay 10 -o $BINARY \
Expand Down
22 changes: 11 additions & 11 deletions hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ CRI_TEST_PLATFORMS=(

# Create releases output directory.
PROJECT="sigs.k8s.io/cri-tools"
CRI_TOOLS_ROOT="$GOPATH/src/$PROJECT"
OUTPUTDIR=$CRI_TOOLS_ROOT/_output/releases
mkdir -p "$OUTPUTDIR"
OUTPUT_DIR=_output
RELEASES_DIR=$OUTPUT_DIR/releases
mkdir -p "$RELEASES_DIR"

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

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

output_bin=${CRI_TOOLS_ROOT}/_output/bin/$arch-$os/${CRICTL_BIN}
output_bin=$OUTPUT_DIR/bin/$arch-$os/${CRICTL_BIN}
GOARCH="$arch" GOOS="$os" CGO_ENABLED=0 go build \
-o ${output_bin} \
-ldflags "${GO_LDFLAGS}" \
${PROJECT}/cmd/crictl
file ${output_bin}
tar zcf "$OUTPUTDIR/crictl-$VERSION-$os-$arch.tar.gz" \
-C ${CRI_TOOLS_ROOT}/_output/bin/$arch-$os \
tar zcf "$RELEASES_DIR/crictl-$VERSION-$os-$arch.tar.gz" \
-C $OUTPUT_DIR/bin/$arch-$os \
${CRICTL_BIN}
done

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

output_bin=${CRI_TOOLS_ROOT}/_output/bin/$arch-$os/${CRITEST_BIN}
output_bin=$OUTPUT_DIR/bin/$arch-$os/${CRITEST_BIN}
GOARCH="$arch" GOOS="$os" CGO_ENABLED=0 go test -c \
-o ${output_bin} \
-ldflags "${GO_LDFLAGS}" \
${PROJECT}/cmd/critest
file ${output_bin}
tar zcf "$OUTPUTDIR/critest-$VERSION-$os-$arch.tar.gz" \
-C ${CRI_TOOLS_ROOT}/_output/bin/$arch-$os \
tar zcf "$RELEASES_DIR/critest-$VERSION-$os-$arch.tar.gz" \
-C $OUTPUT_DIR/bin/$arch-$os \
${CRITEST_BIN}
done

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

# Show sha256/512 for release files
if [[ "${OSTYPE}" == "darwin"* ]]; then
for file in "$OUTPUTDIR"/*.tar.gz; do
for file in "$RELEASES_DIR"/*.tar.gz; do
SHA256=$(shasum -a 256 "$file" | sed -e "s,$file,," | awk '{print $1}' | tee "$file.sha256")
SHA512=$(shasum -a 512 "$file" | sed -e "s,$file,," | awk '{print $1}' | tee "$file.sha512")
BASE=$(basename "$file")
echo "| $BASE | $SHA256 | $SHA512 |" | tee -a release-notes.md
done
else
for file in "$OUTPUTDIR"/*.tar.gz; do
for file in "$RELEASES_DIR"/*.tar.gz; do
SHA256=$(sha256sum -b "$file" | sed -e "s,$file,," | awk '{print $1}' | tee "$file.sha256")
SHA512=$(sha512sum -b "$file" | sed -e "s,$file,," | awk '{print $1}' | tee "$file.sha512")
BASE=$(basename "$file")
Expand Down