5371ffe48a
Gitea act_runner reports as GHES; @actions/artifact v2 (upload/ download-artifact@v4) uses the Twirp API Gitea does not implement, failing with GHESNotSupportedError. v3 uses the artifact protocol Gitea supports. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
100 lines
3.9 KiB
YAML
100 lines
3.9 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-cd-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-cd-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@v3
|
|
with:
|
|
name: nsis-plugin-nsinnounp-windows-${{ github.ref_name }}
|
|
path: artifacts/windows
|
|
|
|
- name: Download Linux artifact
|
|
uses: actions/download-artifact@v3
|
|
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 |