Skip to content

Nightly

Nightly #89

Workflow file for this run

name: Nightly
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
nightly-build:
name: Nightly Build
runs-on: qnap-nas
strategy:
matrix:
goos: [linux]
goarch: [amd64, arm64]
binary:
- controller
- agent
- meta
- csi
- filer
- s3gw
- cli
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
BINARY_NAME: ${{ matrix.binary }}
COMMIT: ${{ github.sha }}
run: |
VERSION="nightly-$(date -u +%Y%m%d)"
BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
go build -ldflags "-X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${BUILD_DATE}" \
-o "bin/novastor-${BINARY_NAME}-${GOOS}-${GOARCH}" \
"./cmd/${BINARY_NAME}/"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: novastor-${{ matrix.binary }}-${{ matrix.goos }}-${{ matrix.goarch }}
path: bin/
nightly-release:
name: Nightly Release
needs: nightly-build
runs-on: qnap-nas
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
merge-multiple: true
- name: Generate checksums
run: |
cd artifacts
sha256sum novastor-* > SHA256SUMS
- name: Generate changelog
id: changelog
run: |
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -n "$LAST_TAG" ]; then
RANGE="${LAST_TAG}..HEAD"
else
RANGE="HEAD"
fi
{
echo "body<<CHANGELOG_EOF"
echo "## Nightly Build $(date -u +%Y-%m-%d)"
echo ""
echo "### Changes since ${LAST_TAG:-initial commit}"
echo ""
for TYPE in Feature Fix Performance Security Test Docs Chore Refactor; do
COMMITS=$(git log "$RANGE" --oneline --grep="\[${TYPE}\]" 2>/dev/null || true)
if [ -n "$COMMITS" ]; then
echo "#### ${TYPE}"
echo "$COMMITS" | while read -r line; do echo "- $line"; done
echo ""
fi
done
echo "CHANGELOG_EOF"
} >> "$GITHUB_OUTPUT"
- name: Create or update nightly release
uses: softprops/action-gh-release@v2
with:
tag_name: nightly
name: Nightly Build
body: ${{ steps.changelog.outputs.body }}
prerelease: true
files: |
artifacts/novastor-*
artifacts/SHA256SUMS
nightly-docker:
name: "Nightly Docker ${{ matrix.image.name }} (${{ matrix.arch.name }})"
needs: nightly-build
strategy:
matrix:
arch:
- name: amd64
runner: qnap-nas
- name: arm64
runner: ubuntu-24.04-arm
image:
- name: controller
dockerfile: build/Dockerfile.controller
- name: agent
dockerfile: build/Dockerfile.agent
- name: meta
dockerfile: build/Dockerfile.meta
- name: csi
dockerfile: build/Dockerfile.csi
- name: filer
dockerfile: build/Dockerfile.filer
- name: s3gw
dockerfile: build/Dockerfile.s3gw
runs-on: ${{ matrix.arch.runner }}
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.image.dockerfile }}
platforms: linux/${{ matrix.arch.name }}
push: true
tags: ghcr.io/azrtydxb/novastor/novastor-${{ matrix.image.name }}:nightly-${{ matrix.arch.name }}
cache-from: type=gha
cache-to: type=gha,mode=max
nightly-docker-manifest:
name: "Docker Manifest ${{ matrix.image }}"
runs-on: qnap-nas
needs: nightly-docker
strategy:
matrix:
image:
- controller
- agent
- meta
- csi
- filer
- s3gw
steps:
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push manifest
env:
IMAGE: ghcr.io/${{ github.repository_owner }}/novastor/novastor-${{ matrix.image }}
run: |
docker manifest create ${IMAGE}:nightly \
--amend ${IMAGE}:nightly-amd64 \
--amend ${IMAGE}:nightly-arm64
docker manifest push ${IMAGE}:nightly