Weekly Docker Compose RISC-V64 Build #18
This file contains hidden or 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: Weekly Docker Compose RISC-V64 Build | |
| on: | |
| schedule: | |
| # Run every Sunday at 03:00 UTC (1 hour after Docker build) | |
| - cron: '0 3 * * 0' | |
| workflow_dispatch: | |
| inputs: | |
| compose_ref: | |
| description: 'Compose ref to build (branch/tag/commit)' | |
| required: false | |
| default: 'main' | |
| permissions: | |
| contents: write | |
| issues: write | |
| actions: write | |
| jobs: | |
| build-compose: | |
| runs-on: [self-hosted, riscv64] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| # Don't checkout all submodules - we only need compose | |
| submodules: false | |
| fetch-depth: 0 | |
| - name: Checkout compose submodule only | |
| run: | | |
| # Only init and update the compose submodule (skip moby, cli, cagent) | |
| git submodule update --init --depth 1 compose | |
| cd compose | |
| git fetch origin --tags | |
| git checkout ${{ github.event.inputs.compose_ref || 'main' }} | |
| # Pull only if it's a branch (not a tag) | |
| if git show-ref --verify --quiet refs/remotes/origin/${{ github.event.inputs.compose_ref || 'main' }}; then | |
| git pull origin ${{ github.event.inputs.compose_ref || 'main' }} | |
| fi | |
| - name: Build docker-compose binary | |
| run: | | |
| set -euo pipefail | |
| cd compose | |
| # Set version from git tag | |
| VERSION=$(git describe --tags --always) | |
| echo "Building compose version: $VERSION" | |
| # Build with version info and explicit GOOS/GOARCH | |
| export GOOS=linux GOARCH=riscv64 CGO_ENABLED=0 | |
| make VERSION="$VERSION" | |
| # Verify binary exists | |
| ls -lh bin/build/docker-compose | |
| - name: Extract binary | |
| run: | | |
| DATE=$(date +%Y%m%d) | |
| mkdir -p release-compose-$DATE | |
| # Copy binary | |
| cp compose/bin/build/docker-compose release-compose-$DATE/ | |
| chmod +x release-compose-$DATE/docker-compose | |
| # Get version | |
| ./release-compose-$DATE/docker-compose version > release-compose-$DATE/VERSION.txt 2>&1 || echo "Version command not available" | |
| ls -lh release-compose-$DATE/ | |
| - name: Create release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| # Ensure gh is installed | |
| if ! command -v gh >/dev/null 2>&1; then | |
| sudo apt-get update && sudo apt-get install -y gh || true | |
| fi | |
| DATE=$(date +%Y%m%d) | |
| COMPOSE_REF="${{ github.event.inputs.compose_ref || 'main' }}" | |
| # Get version from submodule | |
| cd compose | |
| COMPOSE_VERSION=$(git describe --tags --always) | |
| cd .. | |
| # Determine release version (handle both v2.40.1 and 2.40.1 formats) | |
| if [[ "$COMPOSE_REF" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then | |
| # Official release: v2.26.1 or 2.26.1 -> compose-v2.26.1-riscv64 | |
| CLEAN_REF="${COMPOSE_REF#v}" | |
| RELEASE_VERSION="compose-v${CLEAN_REF}-riscv64" | |
| RELEASE_TITLE="Docker Compose v${CLEAN_REF} for RISC-V64" | |
| VERSION_INFO="**Docker Compose Version:** v${CLEAN_REF}" | |
| else | |
| # Development build | |
| RELEASE_VERSION="compose-v${DATE}-dev" | |
| RELEASE_TITLE="Docker Compose RISC-V64 Development Build ${DATE}" | |
| VERSION_INFO="**Compose Branch:** ${COMPOSE_REF} | |
| **Compose Version:** ${COMPOSE_VERSION}" | |
| fi | |
| cat > release-notes.md << EOF | |
| Automated build of Docker Compose v2 plugin for RISC-V64 | |
| ${VERSION_INFO} | |
| **Build Date:** $(date -u +%Y-%m-%d) | |
| **Architecture:** riscv64 | |
| **Installation:** | |
| \`\`\`bash | |
| # Download binary | |
| wget https://github.com/gounthar/docker-for-riscv64/releases/download/${RELEASE_VERSION}/docker-compose | |
| chmod +x docker-compose | |
| # Install as Docker CLI plugin | |
| sudo mkdir -p /usr/libexec/docker/cli-plugins | |
| sudo mv docker-compose /usr/libexec/docker/cli-plugins/ | |
| # Verify | |
| docker compose version | |
| \`\`\` | |
| **Backward Compatibility:** | |
| \`\`\`bash | |
| # Create symlink for legacy docker-compose command | |
| sudo ln -s /usr/libexec/docker/cli-plugins/docker-compose /usr/bin/docker-compose | |
| docker-compose version | |
| \`\`\` | |
| **Build Command:** | |
| \`\`\`bash | |
| cd compose | |
| make VERSION=${COMPOSE_VERSION} | |
| \`\`\` | |
| Automated build on RISC-V64 hardware | |
| EOF | |
| # For development builds, delete existing release if it exists | |
| if [[ "$RELEASE_VERSION" =~ -dev$ ]]; then | |
| echo "Checking for existing development release..." | |
| if gh release view "${RELEASE_VERSION}" >/dev/null 2>&1; then | |
| echo "Deleting existing release ${RELEASE_VERSION}..." | |
| gh release delete "${RELEASE_VERSION}" --yes | |
| fi | |
| fi | |
| gh release create "${RELEASE_VERSION}" \ | |
| --title "${RELEASE_TITLE}" \ | |
| --notes-file release-notes.md \ | |
| release-compose-$DATE/* | |
| - name: Close tracking issue | |
| if: ${{ success() }} | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| COMPOSE_REF="${{ github.event.inputs.compose_ref || 'main' }}" | |
| # Only close issues for official releases (not dev builds) | |
| if [[ "$COMPOSE_REF" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then | |
| # Normalize version format to match release creation | |
| CLEAN_REF="${COMPOSE_REF#v}" | |
| VERSION_TAG="v${CLEAN_REF}" | |
| RELEASE_VERSION="compose-${VERSION_TAG}-riscv64" | |
| echo "Searching for tracking issue for Docker Compose ${VERSION_TAG}..." | |
| # Find the issue by label and title (if tracking workflow exists) | |
| ISSUE_NUMBER=$(gh issue list \ | |
| --label "build-in-progress,compose-release" \ | |
| --state open \ | |
| --limit 200 \ | |
| --json number,title \ | |
| --jq ".[] | select(.title | contains(\"${VERSION_TAG}\")) | .number" \ | |
| | head -n1) | |
| if [ -n "$ISSUE_NUMBER" ]; then | |
| echo "Found tracking issue #${ISSUE_NUMBER}" | |
| # Comment on the issue with release link | |
| gh issue comment "$ISSUE_NUMBER" \ | |
| --body "Build completed successfully! Release published: https://github.com/${{ github.repository }}/releases/tag/${RELEASE_VERSION}" | |
| # Close the issue | |
| gh issue close "$ISSUE_NUMBER" \ | |
| --reason completed \ | |
| --comment "Automatically closing - release published." | |
| echo "Issue #${ISSUE_NUMBER} closed successfully" | |
| else | |
| echo "No tracking issue found for ${VERSION_TAG}" | |
| fi | |
| else | |
| echo "Skipping issue closing for development build" | |
| fi | |
| - name: Trigger package builds | |
| if: ${{ success() }} | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| COMPOSE_REF="${{ github.event.inputs.compose_ref || 'main' }}" | |
| # Only trigger package builds for official releases (not dev builds) | |
| if [[ "$COMPOSE_REF" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then | |
| CLEAN_REF="${COMPOSE_REF#v}" | |
| RELEASE_TAG="compose-v${CLEAN_REF}-riscv64" | |
| echo "Triggering package builds for $RELEASE_TAG..." | |
| # Trigger Debian package build | |
| gh workflow run build-compose-package.yml -f release_tag="$RELEASE_TAG" | |
| echo "✓ Triggered build-compose-package.yml" | |
| # Trigger RPM package build | |
| gh workflow run build-compose-rpm.yml -f release_tag="$RELEASE_TAG" | |
| echo "✓ Triggered build-compose-rpm.yml" | |
| echo "" | |
| echo "Package builds triggered successfully!" | |
| echo "Monitor progress: gh run list --workflow=build-compose-package.yml --limit 1" | |
| else | |
| echo "Skipping package builds for development build" | |
| fi |