6c4e5c2e0e
build-ns7zip builds an EXTERNAL repo (nsis-plugin-ns7zip). The `push: tags v*` trigger (inherited from when this workflow lived in the plugin repo) made every CI-system tag — including the Phase A marker v2.0.0-phaseA — auto-build and publish an ns7zip release on the CI-system repo. Remove the tag trigger; manual dispatch only. The release job's tag-gate `if` now never fires (skipped) — release flow already validated with a throwaway tag. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
127 lines
6.1 KiB
YAML
127 lines
6.1 KiB
YAML
# Build ns7zip (Local CI) — pipeline per nsis-plugin-ns7zip
|
|
#
|
|
# Cross-platform matrix build: runs in parallel on both windows-build (WinRM)
|
|
# and linux-build (SSH) runners using the reusable composite action.
|
|
# Uses: https://gitea.emulab.it/Simone/local-ci-cd-system/.gitea/actions/local-ci-build@main
|
|
#
|
|
# Trigger: SOLO run manuale (workflow_dispatch).
|
|
# Builda un repo ESTERNO (nsis-plugin-ns7zip): i tag del repo
|
|
# CI-system non c'entrano con le release ns7zip. Il vecchio trigger
|
|
# `push: tags v*` (ereditato da quando il workflow viveva nel repo
|
|
# plugin) faceva auto-buildare+pubblicare ns7zip su ogni tag del
|
|
# CI-system (es. il marker Fase A v2.0.0-phaseA) — rimosso.
|
|
|
|
name: Build ns7zip (Local CI)
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
target: [windows, linux]
|
|
fail-fast: false
|
|
|
|
# Runner label must match config.yaml labels: windows-build or linux-build
|
|
runs-on: ${{ matrix.target }}-build
|
|
|
|
steps:
|
|
- uses: https://gitea.emulab.it/Simone/local-ci-cd-system/.gitea/actions/local-ci-build@main
|
|
with:
|
|
# build_plugin.py auto-detects host/toolset and builds all
|
|
# configs by default; --dist forwards to the per-version script
|
|
# which copies the DLLs to <repo>/dist/<config> instead of the
|
|
# committed plugins/ dir.
|
|
build-command: 'python build_plugin.py --dist'
|
|
artifact-source: 'dist'
|
|
submodules: 'true'
|
|
guest-os: ${{ matrix.target == 'linux' && 'Linux' || 'Windows' }}
|
|
# In-guest clone (default). repo-url must be reachable FROM the
|
|
# guest (VMnet8 NAT -> gitea.emulab.it), not the host-only SSH
|
|
# alias. ci_orchestrator injects the GiteaPAT credential into
|
|
# the HTTPS URL, so GiteaPAT must exist in the LocalSystem
|
|
# keyring (Set-CIGuestCredential.ps1 -Target GiteaPAT) — or
|
|
# nsis-plugin-ns7zip must be public.
|
|
use-git-clone: 'true'
|
|
repo-url: 'https://gitea.emulab.it/Simone/nsis-plugin-ns7zip.git'
|
|
# Cross-repo build: github.ref_name is this repo's branch, not
|
|
# nsis-plugin-ns7zip's. Pin the target repo's branch.
|
|
repo-branch: 'main'
|
|
# 8 vCPU / 8 GB. WSL on the host builds the 3 configs in
|
|
# parallel in ~103s (= one config); the 4-vCPU CI VM thrashes
|
|
# (3x make -j on 4 cores) and takes ~3x. Not structural — just
|
|
# vCPU starvation. Host is 10c/20t; this matrix = 2 VMs.
|
|
guest-cpu: '8'
|
|
guest-memory-mb: '8192'
|
|
# Suffix disambiguates artifact dirs: F:\CI\Artifacts\{run_id}-{attempt}-windows
|
|
job-id-suffix: '${{ matrix.target }}'
|
|
artifact-name: 'nsis-plugin-ns7zip-${{ matrix.target }}-${{ github.ref_name }}'
|
|
|
|
# ── Publish Gitea release with build artifacts ────────────────────────────
|
|
# Runs only on tag pushes, after both matrix legs succeed.
|
|
# Requires a GITEA_TOKEN secret with repo write permissions.
|
|
release:
|
|
needs: build
|
|
# Tag pushes only. Explicit ${{ }} + event gate: a bare
|
|
# `if: github.ref_type == 'tag'` can leave the job stuck "blocked"
|
|
# (instead of skipped) on Gitea for workflow_dispatch runs.
|
|
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
|
|
runs-on: windows-build
|
|
|
|
steps:
|
|
# No actions/download-artifact (its code is fetched from github.com).
|
|
# The runner host is single and shared; the build matrix legs left
|
|
# their outputs at F:\CI\Artifacts\{run_id}-{run_attempt}-{target}
|
|
# (job-id-suffix = matrix.target). Read them directly from disk.
|
|
- name: Create Gitea release and upload assets
|
|
shell: powershell
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
GITEA_URL: ${{ github.server_url }}
|
|
REPO: ${{ github.repository }}
|
|
TAG: ${{ github.ref_name }}
|
|
RUN_ID: ${{ github.run_id }}
|
|
RUN_ATTEMPT: ${{ github.run_attempt }}
|
|
run: |
|
|
#Requires -Version 5.1
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$authHeader = @{ Authorization = "token $env:GITEA_TOKEN" }
|
|
$apiBase = "$env:GITEA_URL/api/v1/repos/$env:REPO"
|
|
|
|
# Create the release (non-draft, non-prerelease)
|
|
$releaseBody = @{
|
|
tag_name = $env:TAG
|
|
name = $env:TAG
|
|
draft = $false
|
|
prerelease = $false
|
|
} | ConvertTo-Json
|
|
$jsonHeaders = $authHeader + @{ 'Content-Type' = 'application/json' }
|
|
$release = Invoke-RestMethod -Method Post -Uri "$apiBase/releases" `
|
|
-Headers $jsonHeaders -Body $releaseBody
|
|
$releaseId = $release.id
|
|
Write-Host "Release created: id=$releaseId name=$($release.name)"
|
|
|
|
# Compress each host-side artifact directory and upload as a
|
|
# release asset. The build legs collected to
|
|
# F:\CI\Artifacts\{run_id}-{run_attempt}-{target}.
|
|
foreach ($target in @('windows', 'linux')) {
|
|
$srcDir = "F:\CI\Artifacts\$env:RUN_ID-$env:RUN_ATTEMPT-$target"
|
|
if (-not (Test-Path -LiteralPath $srcDir) -or
|
|
-not (Get-ChildItem -Force -LiteralPath $srcDir)) {
|
|
throw "artifact dir missing or empty: $srcDir"
|
|
}
|
|
$zipName = "nsis-plugin-ns7zip-$target-$env:TAG.zip"
|
|
Compress-Archive -Path "$srcDir\*" -DestinationPath $zipName -Force
|
|
|
|
$uploadUrl = "$apiBase/releases/$releaseId/assets?name=$zipName"
|
|
$uploadHeaders = $authHeader + @{ 'Content-Type' = 'application/zip' }
|
|
$zipBytes = [System.IO.File]::ReadAllBytes(
|
|
(Resolve-Path $zipName).ProviderPath)
|
|
Invoke-RestMethod -Method Post -Uri $uploadUrl `
|
|
-Headers $uploadHeaders -Body $zipBytes | Out-Null
|
|
Write-Host "Uploaded asset: $zipName"
|
|
}
|
|
Write-Host "Release $env:TAG published with $($release.html_url)" |