Files
local-ci-cd-system/gitea/workflows/build-nsInnoUnp.yml
T
Simone 5d1b47e943 feat(workflow): rinomina build-nsis.yml -> build-nsInnoUnp.yml, aggiunge job release
- Rinominato gitea/workflows/build-nsis.yml in build-nsInnoUnp.yml
- Aggiunto job release: scarica artifact Windows+Linux, crea release Gitea
  via API REST, comprime e uploada gli asset come zip (richiede secret GITEA_TOKEN)
- Aggiornati tutti i riferimenti in README.md, TODO.md, plans/*.md
2026-05-12 23:37:00 +02:00

104 lines
4.0 KiB
YAML

# Build (Local CI) — pipeline per nsis-plugin-nsinnounp
#
# Cross-platform matrix build: runs in parallel on both windows-build (WinRM)
# and linux-build (SSH) runners using the reusable composite action.
# Uses: Simone/local-ci-system/.gitea/actions/local-ci-build@main
#
# Trigger: push su tag v*, oppure run manuale
name: Build (Local CI)
on:
push:
tags:
- 'v*'
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: Simone/local-ci-system/.gitea/actions/local-ci-build@main
with:
build-command: 'python build_plugin.py --final --dist-dir dist'
artifact-source: 'dist'
submodules: 'true'
guest-os: ${{ matrix.target == 'linux' && 'Linux' || 'Windows' }}
# SSH URL alias configured in host ~/.ssh/config — same for both runners
repo-url: 'ssh://gitea-ci/Simone/nsis-plugin-nsinnounp.git'
# Suffix disambiguates artifact dirs: F:\CI\Artifacts\{run_id}-{attempt}-windows
job-id-suffix: '${{ matrix.target }}'
artifact-name: 'nsis-plugin-nsinnounp-${{ 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
if: github.ref_type == 'tag'
runs-on: windows-build
steps:
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: nsis-plugin-nsinnounp-windows-${{ github.ref_name }}
path: artifacts/windows
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: nsis-plugin-nsinnounp-linux-${{ github.ref_name }}
path: artifacts/linux
- 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: |
#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 artifact directory and upload as a release asset
foreach ($target in @('windows', 'linux')) {
$srcDir = "artifacts\$target"
$zipName = "nsis-plugin-nsinnounp-$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"
}