Merge pull request #623 from dmcgowan/containerd-2.0.0 #60
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
on: | |
push: | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+* | |
env: | |
CARGO_TERM_COLOR: always | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
include: | |
- build-os: linux | |
build-arch: amd64 | |
build-linker: x86-64 | |
- build-os: linux | |
build-arch: arm64 | |
build-linker: aarch64 | |
- build-os: linux | |
build-arch: s390x | |
build-linker: s390x | |
- build-os: linux | |
build-arch: ppc64le | |
build-linker: powerpc64le | |
- build-os: linux | |
build-arch: riscv64 | |
build-linker: riscv64 | |
- build-os: linux | |
build-arch: static | |
build-linker: static | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22.5" | |
- name: cache go mod | |
uses: actions/cache@v4 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ matrix.build-os }}-go-${{ hashFiles('go.sum') }} | |
restore-keys: | | |
${{ matrix.build-os }}-go | |
- name: cache cargo | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
tools/optimizer-server/target/ | |
key: ${{ matrix.build-os }}-cargo-${{ hashFiles('tools/optimizer-server/Cargo.lock') }} | |
restore-keys: | | |
${{ matrix.build-os }}-cargo | |
- name: install gnu gcc linker | |
run: | | |
if [ "${{ matrix.build-linker }}" != "static" ]; then | |
sudo apt-get install -qq gcc-${{ matrix.build-linker }}-linux-gnu | |
fi | |
- name: build nydus-snapshotter and optimizer | |
run: | | |
go install github.com/golangci/golangci-lint/cmd/[email protected] | |
export PATH=$PATH:$(go env GOPATH)/bin | |
if [ "${{ matrix.build-arch }}" == "static" ]; then | |
make static-package | |
else | |
make package GOOS=${{ matrix.build-os }} GOARCH=${{ matrix.build-arch }} | |
fi | |
- name: upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-tars-${{ matrix.build-os }}-${{ matrix.build-arch }} | |
path: | | |
package/*.tar.gz* | |
overwrite: true | |
upload: | |
runs-on: ubuntu-22.04 | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: builds | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: "Nydus Snapshotter ${{ github.ref_name }} Release" | |
generate_release_notes: true | |
files: | | |
builds/release-tars-**/* | |
publish-image: | |
runs-on: ubuntu-22.04 | |
needs: [build] | |
strategy: | |
matrix: | |
include: | |
- build-os: linux | |
build-arch: amd64 | |
- build-os: linux | |
build-arch: arm64 | |
- build-os: linux | |
build-arch: s390x | |
- build-os: linux | |
build-arch: ppc64le | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-tars-${{ matrix.build-os }}-${{ matrix.build-arch }} | |
path: misc/snapshotter | |
- name: unpack static release | |
run: | | |
cd misc/snapshotter && tar -zxf *.tar.gz && mv bin/* . && rm -rf bin | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Get the nydusd version | |
run: | | |
export NYDUS_STABLE_VER=$(curl -fsSL https://api.github.com/repos/dragonflyoss/nydus/releases/latest | jq -r .tag_name) | |
echo "NYDUS_STABLE_VER=$NYDUS_STABLE_VER" >> "$GITHUB_ENV" | |
printf 'nydus version is: %s\n' "$NYDUS_STABLE_VER" | |
- name: build and push nydus-snapshotter image | |
uses: docker/build-push-action@v5 | |
with: | |
context: misc/snapshotter | |
file: misc/snapshotter/Dockerfile | |
push: true | |
platforms: ${{ matrix.build-os }}/${{ matrix.build-arch }} | |
provenance: false | |
tags: | | |
${{ fromJSON(steps.meta.outputs.json).tags[0] }}-${{ matrix.build-arch }} | |
${{ fromJSON(steps.meta.outputs.json).tags[1] }}-${{ matrix.build-arch }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: NYDUS_VER=${{ env.NYDUS_STABLE_VER }} | |
publish-manifest: | |
runs-on: ubuntu-22.04 | |
needs: [publish-image] | |
steps: | |
- name: Log in to the container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Publish manifest for multi-arch image | |
run: | | |
IFS=',' read -ra tags <<< "$(echo "${{ steps.meta.outputs.tags }}" | tr '\n' ',')" | |
for tag in "${tags[@]}"; do | |
docker manifest create "${tag}" \ | |
--amend "${tag}-amd64" \ | |
--amend "${tag}-arm64" \ | |
--amend "${tag}-s390x" \ | |
--amend "${tag}-ppc64le" | |
docker manifest push "${tag}" | |
done |