143 lines
4.9 KiB
YAML
143 lines
4.9 KiB
YAML
on:
|
|
push:
|
|
tags:
|
|
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
|
|
|
|
name: Containerd Release
|
|
|
|
env:
|
|
GO_VERSION: '1.18.5'
|
|
|
|
jobs:
|
|
check:
|
|
name: Check Signed Tag
|
|
runs-on: ubuntu-18.04
|
|
timeout-minutes: 5
|
|
outputs:
|
|
stringver: ${{ steps.contentrel.outputs.stringver }}
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ github.ref }}
|
|
path: src/github.com/containerd/containerd
|
|
|
|
- name: Check signature
|
|
run: |
|
|
releasever=${{ github.ref }}
|
|
releasever="${releasever#refs/tags/}"
|
|
TAGCHECK=$(git tag -v ${releasever} 2>&1 >/dev/null) ||
|
|
echo "${TAGCHECK}" | grep -q "error" && {
|
|
echo "::error::tag ${releasever} is not a signed tag. Failing release process."
|
|
exit 1
|
|
} || {
|
|
echo "Tag ${releasever} is signed."
|
|
exit 0
|
|
}
|
|
working-directory: src/github.com/containerd/containerd
|
|
|
|
- name: Release content
|
|
id: contentrel
|
|
run: |
|
|
RELEASEVER=${{ github.ref }}
|
|
echo "::set-output name=stringver::${RELEASEVER#refs/tags/v}"
|
|
git tag -l ${RELEASEVER#refs/tags/} -n20000 | tail -n +3 | cut -c 5- >release-notes.md
|
|
working-directory: src/github.com/containerd/containerd
|
|
|
|
- name: Save release notes
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: containerd-release-notes
|
|
path: src/github.com/containerd/containerd/release-notes.md
|
|
|
|
build:
|
|
name: Build Release Binaries
|
|
runs-on: ${{ matrix.os }}
|
|
needs: [check]
|
|
timeout-minutes: 10
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-18.04]
|
|
platform:
|
|
- linux/amd64
|
|
- linux/arm64
|
|
- linux/ppc64le
|
|
- linux/riscv64
|
|
- windows/amd64
|
|
steps:
|
|
- name: Install Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
- name: Set env
|
|
shell: bash
|
|
env:
|
|
MOS: ${{ matrix.os }}
|
|
run: |
|
|
releasever=${{ github.ref }}
|
|
releasever="${releasever#refs/tags/}"
|
|
echo "RELEASE_VER=${releasever}" >> $GITHUB_ENV
|
|
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
|
|
- name: Checkout containerd
|
|
uses: actions/checkout@v2
|
|
with:
|
|
# Intentionally use github.repository instead of containerd/containerd to
|
|
# make this action runnable on forks.
|
|
# See https://github.com/containerd/containerd/issues/5098 for the context.
|
|
repository: ${{ github.repository }}
|
|
ref: ${{ github.ref }}
|
|
path: src/github.com/containerd/containerd
|
|
|
|
- name: Setup buildx instance
|
|
uses: docker/setup-buildx-action@v1
|
|
with:
|
|
use: true
|
|
- uses: crazy-max/ghaction-github-runtime@v1 # sets up needed vars for caching to github
|
|
- name: Make
|
|
shell: bash
|
|
run: |
|
|
cache="--cache-from=type=gha,scope=containerd-release --cache-to=type=gha,scope=containerd-release"
|
|
if [[ "${PLATFORM}" =~ "windows" ]]; then
|
|
# For Windows the cni build script generates a config but shells out to powershell (and also assume it is running on windows) to get a gateway and subnet.
|
|
# The values provided here are taken from packages that we previously generated.
|
|
export GATEWAY=172.21.16.1
|
|
export PREFIX_LEN=12
|
|
BUILD_ARGS="--build-arg GATEWAY --build-arg PREFIX_LEN"
|
|
fi
|
|
docker buildx build ${cache} --build-arg RELEASE_VER --build-arg GO_VERSION ${BUILD_ARGS} -f .github/workflows/release/Dockerfile --platform=${PLATFORM} -o releases/ .
|
|
echo PLATFORM_CLEAN=${PLATFORM/\//-} >> $GITHUB_ENV
|
|
|
|
# Remove symlinks since we don't want these in the release Artifacts
|
|
find ./releases/ -maxdepth 1 -type l | xargs rm
|
|
working-directory: src/github.com/containerd/containerd
|
|
env:
|
|
PLATFORM: ${{ matrix.platform }}
|
|
- name: Save Artifacts
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: release-tars-${{env.PLATFORM_CLEAN}}
|
|
path: src/github.com/containerd/containerd/releases/*.tar.gz*
|
|
|
|
release:
|
|
name: Create containerd Release
|
|
runs-on: ubuntu-18.04
|
|
timeout-minutes: 10
|
|
needs: [build, check]
|
|
steps:
|
|
- name: Download builds and release notes
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
path: builds
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
fail_on_unmatched_files: true
|
|
name: containerd ${{ needs.check.outputs.stringver }}
|
|
draft: false
|
|
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
|
|
body_path: ./builds/containerd-release-notes/release-notes.md
|
|
files: |
|
|
builds/release-tars-**/*
|