Skip to content

Merge pull request #1878 from ktock/prepare-v0.16.2 #35

Merge pull request #1878 from ktock/prepare-v0.16.2

Merge pull request #1878 from ktock/prepare-v0.16.2 #35

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
env:
DOCKER_BUILDKIT: 1
jobs:
build:
runs-on: ubuntu-24.04
name: Build
strategy:
matrix:
arch: ["amd64", "arm-v7", "arm64", "ppc64le", "s390x"]
env:
OUTPUT_DIR: ${{ github.workspace }}/out
steps:
- uses: actions/checkout@v4
- name: Build Binary
env:
DOCKER_BUILDKIT: 1
run: |
mkdir ${OUTPUT_DIR}
RELEASE_TAG="${GITHUB_REF##*/}"
ARCH_ID="${{ matrix.arch }}"
BUILD_ARGS=--build-arg=TARGETARCH=${ARCH_ID}
if [ "${ARCH_ID}" == "arm-v7" ] ; then
BUILD_ARGS="--build-arg=TARGETARCH=arm --build-arg=GOARM=7"
fi
# make binaries static
BUILD_ARGS="$BUILD_ARGS --build-arg=CGO_ENABLED=0"
TAR_FILE_NAME="stargz-snapshotter-${RELEASE_TAG}-linux-${ARCH_ID}.tar.gz"
SHA256SUM_FILE_NAME="${TAR_FILE_NAME}.sha256sum"
docker build ${BUILD_ARGS} --target release-binaries -o - . | gzip > "${OUTPUT_DIR}/${TAR_FILE_NAME}"
( cd ${OUTPUT_DIR}; sha256sum ${TAR_FILE_NAME} ) > "${OUTPUT_DIR}/${SHA256SUM_FILE_NAME}"
- name: Save Binary
uses: actions/upload-artifact@v4
with:
name: builds-${{ matrix.arch }}
path: ${{ env.OUTPUT_DIR }}/*
release:
runs-on: ubuntu-24.04
name: Release
needs: [build]
env:
OUTPUT_DIR: ${{ github.workspace }}/builds
steps:
- uses: actions/checkout@v4
- name: Download Builds
uses: actions/download-artifact@v4
with:
path: ${{ env.OUTPUT_DIR }}
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
RELEASE_TAG="${GITHUB_REF##*/}"
cat <<EOF > ${GITHUB_WORKSPACE}/release-note.txt
(TBD)
EOF
ASSET_ARGS=()
ls -al ${OUTPUT_DIR}/
for A in "amd64" "arm-v7" "arm64" "ppc64le" "s390x" ; do
ASSET_ARGS+=("${OUTPUT_DIR}/builds-${A}/*")
done
gh release create -F ${GITHUB_WORKSPACE}/release-note.txt --draft --title "${RELEASE_TAG}" "${RELEASE_TAG}" ${ASSET_ARGS[@]}