ci: enhance build and release workflows with improved artifact handling and versioning
This commit is contained in:
+46
-13
@@ -8,23 +8,26 @@
|
|||||||
# Trigger:
|
# Trigger:
|
||||||
# - push su main (incluso quello propagato dal mirror Gitea)
|
# - push su main (incluso quello propagato dal mirror Gitea)
|
||||||
# - PR aperte su GitHub
|
# - PR aperte su GitHub
|
||||||
# - run manuale via UI
|
# - run manuale via UI (senza input)
|
||||||
|
|
||||||
name: Build
|
name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches:
|
||||||
|
- main
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
- 'examples/**'
|
- 'examples/**'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches:
|
||||||
|
- main
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
if: ${{ false }}
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -44,15 +47,30 @@ jobs:
|
|||||||
- name: Setup MSBuild
|
- name: Setup MSBuild
|
||||||
uses: microsoft/setup-msbuild@v3
|
uses: microsoft/setup-msbuild@v3
|
||||||
|
|
||||||
|
- name: Build ${{ matrix.config }}
|
||||||
|
run: python build_plugin.py --configs ${{ matrix.config }} --verbosity normal
|
||||||
|
|
||||||
- name: Read VERSION
|
- name: Read VERSION
|
||||||
id: version
|
id: version
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
$v = (Get-Content VERSION -Raw).Trim()
|
$v = (Get-Content VERSION -Raw).Trim()
|
||||||
|
$map = @{ 'x86-ansi' = 'x86-ansi'; 'x86-unicode' = 'x86-unicode'; 'x64-unicode' = 'amd64-unicode' }
|
||||||
|
$dir = $map['${{ matrix.config }}']
|
||||||
"version=$v" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
|
"version=$v" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
|
||||||
|
"dir=$dir" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
|
||||||
|
|
||||||
- name: Build ${{ matrix.config }}
|
- name: Package
|
||||||
run: python build_plugin.py --configs ${{ matrix.config }} --verbosity normal
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
$name = "${{ github.event.repository.name }}-${{ steps.version.outputs.version }}-${{ steps.version.outputs.dir }}"
|
||||||
|
$stage = "stage/$name"
|
||||||
|
New-Item -ItemType Directory -Force -Path $stage | Out-Null
|
||||||
|
Copy-Item "dist/${{ steps.version.outputs.dir }}/*" $stage -Recurse
|
||||||
|
Copy-Item README.md, LICENSE, VERSION, CHANGELOG.md $stage
|
||||||
|
if (Test-Path "include") { Copy-Item "include" $stage -Recurse }
|
||||||
|
if (Test-Path "examples") { Copy-Item "examples" $stage -Recurse }
|
||||||
|
Compress-Archive -Path "$stage/*" -DestinationPath "$name.zip" -Force
|
||||||
|
|
||||||
- name: Collect DLL
|
- name: Collect DLL
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
@@ -63,15 +81,22 @@ jobs:
|
|||||||
New-Item -ItemType Directory -Force -Path $dst | Out-Null
|
New-Item -ItemType Directory -Force -Path $dst | Out-Null
|
||||||
Copy-Item $src $dst
|
Copy-Item $src $dst
|
||||||
|
|
||||||
|
- name: Upload zip
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: pkg-${{ matrix.config }}
|
||||||
|
path: '*.zip'
|
||||||
|
|
||||||
- name: Upload DLL
|
- name: Upload DLL
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: ${{ github.event.repository.name }}-${{ steps.version.outputs.version }}-${{ matrix.config }}
|
name: ${{ github.event.repository.name }}-${{ steps.version.outputs.version }}-${{ matrix.config }}
|
||||||
path: dist/**
|
path: dist/**/*.dll
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
|
|
||||||
build-linux:
|
build-linux:
|
||||||
|
if: ${{ false }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -98,12 +123,6 @@ jobs:
|
|||||||
g++-mingw-w64-i686 \
|
g++-mingw-w64-i686 \
|
||||||
g++-mingw-w64-x86-64
|
g++-mingw-w64-x86-64
|
||||||
|
|
||||||
- name: Read VERSION
|
|
||||||
id: version_linux
|
|
||||||
run: |
|
|
||||||
v="$(tr -d '\r\n' < VERSION)"
|
|
||||||
echo "version=$v" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Build ${{ matrix.config }} on Linux
|
- name: Build ${{ matrix.config }} on Linux
|
||||||
run: python build_plugin.py --host linux --configs ${{ matrix.config }} --verbose
|
run: python build_plugin.py --host linux --configs ${{ matrix.config }} --verbose
|
||||||
|
|
||||||
@@ -118,10 +137,24 @@ jobs:
|
|||||||
mkdir -p "$dst"
|
mkdir -p "$dst"
|
||||||
cp "plugins/$dir/nsis7z.dll" "$dst/"
|
cp "plugins/$dir/nsis7z.dll" "$dst/"
|
||||||
|
|
||||||
- name: Upload DLL
|
- name: Read VERSION
|
||||||
|
id: version_linux
|
||||||
|
run: |
|
||||||
|
v="$(tr -d '\r\n' < VERSION)"
|
||||||
|
echo "version=$v" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: ${{ github.event.repository.name }}-${{ steps.version_linux.outputs.version }}-${{ matrix.config }}-linux
|
name: ${{ github.event.repository.name }}-${{ steps.version_linux.outputs.version }}-${{ matrix.config }}-linux
|
||||||
path: dist/**
|
path: dist/**
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
|
|
||||||
|
- name: Upload DLL
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: ${{ github.event.repository.name }}-${{ steps.version_linux.outputs.version }}-${{ matrix.config }}-linux-dll
|
||||||
|
path: dist/**/*.dll
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 30
|
||||||
|
|||||||
@@ -1,18 +1,27 @@
|
|||||||
# Release (GitHub) — pipeline release primaria
|
# Release (GitHub) — pipeline release primaria
|
||||||
#
|
#
|
||||||
# Triggerata quando un tag v* viene propagato dal mirror Gitea.
|
# Strategia hosting:
|
||||||
# Costruisce gli artifact per tutte le architetture e crea la GitHub Release.
|
# - Repo primario su Gitea (push iniziale)
|
||||||
|
# - Push mirror automatico Gitea -> GitHub
|
||||||
|
# - GitHub esegue TUTTA la CI (Gitea non esegue Actions)
|
||||||
|
#
|
||||||
|
# Trigger:
|
||||||
|
# - push di un tag v* (propagato dal mirror Gitea)
|
||||||
|
#
|
||||||
|
# - run manuale via UI (con input 'tag')
|
||||||
|
|
||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags: ['v*']
|
tags:
|
||||||
|
- 'v*'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
tag:
|
tag:
|
||||||
description: 'Tag versione (es. v1.7.0)'
|
description: 'Tag versione (es. v1.7.0)'
|
||||||
required: true
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -21,25 +30,28 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
config: [x86-ansi, x86-unicode, x64-unicode]
|
config: [x86-ansi, x86-unicode, x64-unicode]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- uses: actions/setup-python@v6
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: '3.11'
|
||||||
|
|
||||||
- uses: microsoft/setup-msbuild@v3
|
- name: Setup MSBuild
|
||||||
|
uses: microsoft/setup-msbuild@v3
|
||||||
|
|
||||||
- name: Build ${{ matrix.config }}
|
- name: Build ${{ matrix.config }}
|
||||||
run: python build_plugin.py --config ${{ matrix.config }}
|
run: python build_plugin.py --configs ${{ matrix.config }} --verbosity normal
|
||||||
|
|
||||||
- name: Determine version & arch
|
- name: Read VERSION
|
||||||
id: meta
|
id: version
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
$tag = "${{ github.ref_name }}"
|
$tag = "${{ github.ref_name }}"
|
||||||
@@ -54,32 +66,51 @@ jobs:
|
|||||||
- name: Package
|
- name: Package
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
$name = "${{ github.event.repository.name }}-${{ steps.meta.outputs.version }}-${{ steps.meta.outputs.dir }}"
|
$name = "${{ github.event.repository.name }}-${{ steps.version.outputs.version }}-${{ steps.version.outputs.dir }}"
|
||||||
$stage = "stage/$name"
|
$stage = "stage/$name"
|
||||||
New-Item -ItemType Directory -Force -Path $stage | Out-Null
|
New-Item -ItemType Directory -Force -Path $stage | Out-Null
|
||||||
Copy-Item "dist/${{ steps.meta.outputs.dir }}/*" $stage -Recurse
|
Copy-Item "dist/${{ steps.version.outputs.dir }}/*" $stage -Recurse
|
||||||
Copy-Item README.md, LICENSE, VERSION, CHANGELOG.md $stage
|
Copy-Item README.md, LICENSE, VERSION, CHANGELOG.md $stage
|
||||||
if (Test-Path "include") { Copy-Item "include" $stage -Recurse }
|
if (Test-Path "include") { Copy-Item "include" $stage -Recurse }
|
||||||
if (Test-Path "examples") { Copy-Item "examples" $stage -Recurse }
|
if (Test-Path "examples") { Copy-Item "examples" $stage -Recurse }
|
||||||
Compress-Archive -Path "$stage/*" -DestinationPath "$name.zip" -Force
|
Compress-Archive -Path "$stage/*" -DestinationPath "$name.zip" -Force
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v7
|
- name: Collect DLL
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
$map = @{ 'x86-ansi' = 'x86-ansi'; 'x86-unicode' = 'x86-unicode'; 'x64-unicode' = 'amd64-unicode' }
|
||||||
|
$src = "plugins\$($map['${{ matrix.config }}'])\nsis7z.dll"
|
||||||
|
$dst = "dist\${{ matrix.config }}"
|
||||||
|
New-Item -ItemType Directory -Force -Path $dst | Out-Null
|
||||||
|
Copy-Item $src $dst
|
||||||
|
|
||||||
|
- name: Upload zip
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: pkg-${{ matrix.config }}
|
name: pkg-${{ matrix.config }}
|
||||||
path: '*.zip'
|
path: '*.zip'
|
||||||
|
|
||||||
|
- name: Upload DLL
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: dll-win-${{ matrix.config }}
|
||||||
|
path: dist/**/*.dll
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
build-linux:
|
build-linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
config: [x86-ansi, x86-unicode, x64-unicode]
|
config: [x86-ansi, x86-unicode, x64-unicode]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- uses: actions/setup-python@v6
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: '3.11'
|
||||||
|
|
||||||
@@ -94,7 +125,7 @@ jobs:
|
|||||||
g++-mingw-w64-x86-64
|
g++-mingw-w64-x86-64
|
||||||
|
|
||||||
- name: Build ${{ matrix.config }} on Linux
|
- name: Build ${{ matrix.config }} on Linux
|
||||||
run: python build_plugin.py --host linux --configs ${{ matrix.config }}
|
run: python build_plugin.py --host linux --configs ${{ matrix.config }} --verbose
|
||||||
|
|
||||||
- name: Collect DLL
|
- name: Collect DLL
|
||||||
run: |
|
run: |
|
||||||
@@ -107,19 +138,29 @@ jobs:
|
|||||||
mkdir -p "$dst"
|
mkdir -p "$dst"
|
||||||
cp "plugins/$dir/nsis7z.dll" "$dst/"
|
cp "plugins/$dir/nsis7z.dll" "$dst/"
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v7
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: linux-build-${{ matrix.config }}
|
name: linux-build-${{ matrix.config }}
|
||||||
path: dist/**
|
path: dist/**
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Upload DLL
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: dll-linux-${{ matrix.config }}
|
||||||
|
path: dist/**/*.dll
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
needs: [build, build-linux]
|
needs: [build, build-linux]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- uses: actions/download-artifact@v8
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v8
|
||||||
with:
|
with:
|
||||||
path: artifacts
|
path: artifacts
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
@@ -152,6 +193,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
artifacts/*.zip
|
artifacts/*.zip
|
||||||
|
artifacts/**/*.dll
|
||||||
artifacts/SHA256SUMS.txt
|
artifacts/SHA256SUMS.txt
|
||||||
body_path: release_body.md
|
body_path: release_body.md
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user