-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (89 loc) · 3.93 KB
/
Copy pathbuild.yml
File metadata and controls
98 lines (89 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Build PCM Linux GTK3
on:
push:
branches: ["**"]
tags:
- "v*"
pull_request:
branches: ["**"]
jobs:
build:
name: Build tar.gz + zip + deb
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Determine version and release info
id: version
run: |
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
VERSION="${GITHUB_REF#refs/tags/v}"
RELEASE_TAG="v${VERSION}"
IS_TAG=true
else
SHORT_SHA=$(git rev-parse --short HEAD)
VERSION="0.0.0-${SHORT_SHA}"
RELEASE_TAG="dev-${SHORT_SHA}"
IS_TAG=false
COMMIT_SUBJECT=$(git log -1 --pretty=%s)
RELEASE_NAME="PCM dev ${SHORT_SHA} - ${COMMIT_SUBJECT}"
fi
echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
echo "RELEASE_TAG=${RELEASE_TAG}" >> "$GITHUB_OUTPUT"
echo "IS_TAG=${IS_TAG}" >> "$GITHUB_OUTPUT"
echo "RELEASE_NAME=${RELEASE_NAME:-}" >> "$GITHUB_OUTPUT"
echo "Versione: ${VERSION}"
- name: Install build dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends dpkg
- name: Build packages
run: |
bash linuxbuild/build.sh "${{ steps.version.outputs.VERSION }}" --zip --deb
- name: Upload artifacts (Actions interno — solo per PR e ispezione)
uses: actions/upload-artifact@v4
with:
name: PCM_v${{ steps.version.outputs.VERSION }}_Linux
path: |
dist/PCM_v${{ steps.version.outputs.VERSION }}_Linux_GTK3.tar.gz
dist/PCM_v${{ steps.version.outputs.VERSION }}_Linux_GTK3.zip
dist/pcm_${{ steps.version.outputs.VERSION }}_all.deb
if-no-files-found: error
# ── Release per push su branch (dev build) ──────────────────────────────
# Per i tag NON creiamo la release: la crea versiona.sh con le note AI.
- name: Create dev release (branch push only)
if: github.event_name == 'push' && steps.version.outputs.IS_TAG == 'false'
env:
GH_TOKEN: ${{ github.token }}
run: |
git log -1 --pretty=%B > /tmp/release_notes.txt
gh release create "${{ steps.version.outputs.RELEASE_TAG }}" \
--title "${{ steps.version.outputs.RELEASE_NAME }}" \
--prerelease \
--notes-file /tmp/release_notes.txt \
"dist/PCM_v${{ steps.version.outputs.VERSION }}_Linux_GTK3.tar.gz" \
"dist/PCM_v${{ steps.version.outputs.VERSION }}_Linux_GTK3.zip" \
"dist/pcm_${{ steps.version.outputs.VERSION }}_all.deb"
# ── Upload artefatti su release esistente (tag push) ────────────────────
# versiona.sh crea la release con gh release create (che pusha il tag).
# Quando Actions riceve il push del tag la release esiste già.
# Il loop di attesa copre il caso estremo in cui versiona.sh sia lento.
- name: Upload artifacts to existing release (tag push only)
if: github.event_name == 'push' && steps.version.outputs.IS_TAG == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
RELEASE_TAG="${{ steps.version.outputs.RELEASE_TAG }}"
echo "Attesa release ${RELEASE_TAG}..."
for i in $(seq 1 24); do
gh release view "${RELEASE_TAG}" &>/dev/null && break
echo "Tentativo ${i}/24, attendo 10s..."
sleep 10
done
gh release upload "${RELEASE_TAG}" \
"dist/PCM_v${{ steps.version.outputs.VERSION }}_Linux_GTK3.tar.gz" \
"dist/PCM_v${{ steps.version.outputs.VERSION }}_Linux_GTK3.zip" \
"dist/pcm_${{ steps.version.outputs.VERSION }}_all.deb" \
--clobber