-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (76 loc) · 2.91 KB
/
build.yml
File metadata and controls
87 lines (76 loc) · 2.91 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
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_PRERELEASE=false
RELEASE_NAME="PCM v${VERSION}"
else
SHORT_SHA=$(git rev-parse --short HEAD)
VERSION="0.0.0-${SHORT_SHA}"
RELEASE_TAG="dev-${SHORT_SHA}"
IS_PRERELEASE=true
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_PRERELEASE=${IS_PRERELEASE}" >> "$GITHUB_OUTPUT"
echo "RELEASE_NAME=${RELEASE_NAME}" >> "$GITHUB_OUTPUT"
echo "Versione: ${VERSION}"
- name: Write release notes
run: git log -1 --pretty=%B > /tmp/release_notes.txt
- 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 tar.gz
uses: actions/upload-artifact@v4
with:
name: PCM_v${{ steps.version.outputs.VERSION }}_Linux_GTK3.tar.gz
path: dist/PCM_v${{ steps.version.outputs.VERSION }}_Linux_GTK3.tar.gz
if-no-files-found: error
- name: Upload zip
uses: actions/upload-artifact@v4
with:
name: PCM_v${{ steps.version.outputs.VERSION }}_Linux_GTK3.zip
path: dist/PCM_v${{ steps.version.outputs.VERSION }}_Linux_GTK3.zip
if-no-files-found: error
- name: Upload deb
uses: actions/upload-artifact@v4
with:
name: pcm_${{ steps.version.outputs.VERSION }}_all.deb
path: dist/pcm_${{ steps.version.outputs.VERSION }}_all.deb
if-no-files-found: error
- name: Create GitHub Release
if: github.event_name == 'push'
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "${{ steps.version.outputs.RELEASE_TAG }}" \
--title "${{ steps.version.outputs.RELEASE_NAME }}" \
--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"