-
Notifications
You must be signed in to change notification settings - Fork 371
164 lines (149 loc) · 4.93 KB
/
Copy pathlaunchpad-ppa.yml
File metadata and controls
164 lines (149 loc) · 4.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Launchpad PPA
permissions:
contents: read
on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main
workflow_dispatch:
jobs:
prepare-matrix:
name: Prepare matrix
runs-on: ubuntu-latest
outputs:
package_matrix: ${{ steps.set-matrix.outputs.package_matrix }}
steps:
- name: Define shared matrix values
id: set-matrix
run: |
{
echo 'package_matrix<<EOF'
cat <<'JSON'
{
"include": [
{
"ubuntu_version": "24.04",
"container_tag": "ubuntu24.04",
"deb_codename": "noble"
},
{
"ubuntu_version": "25.10",
"container_tag": "ubuntu25.10",
"deb_codename": "questing"
},
{
"ubuntu_version": "26.04",
"container_tag": "ubuntu26.04",
"deb_codename": "resolute"
}
]
}
JSON
echo 'EOF'
} >> "$GITHUB_OUTPUT"
package:
name: Build
needs: prepare-matrix
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix: ${{ fromJSON(needs.prepare-matrix.outputs.package_matrix) }}
container:
image: ghcr.io/lemonade-sdk/lemonade/build-environment:${{ matrix.container_tag }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
fetch-tags: true
- name: Configure git safe directory
run: git config --global --add safe.directory $(pwd)
- name: Get version from git describe
id: get_version
run: |
VERSION=$(git describe --tags --always)
# Strip leading 'v' for Debian version compatibility
DEB_VERSION=$(echo "${VERSION}" | sed 's/^v//')
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "deb_version=${DEB_VERSION}" >> $GITHUB_OUTPUT
- name: Get short SHA
id: short_sha
run: echo "sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT
- name: Create Debian packaging metadata
working-directory: ${{ github.workspace }}
run: |
mv contrib/debian .
sed -e "s|@@DEB_VERSION@@|${{ steps.get_version.outputs.deb_version }}~${{ matrix.ubuntu_version }}|g" \
-e "s|@@DEB_CODENAME@@|${{ matrix.deb_codename }}|g" \
-e "s|@@DEB_DATE@@|$(date -R)|g" \
debian/changelog.in > debian/changelog
- name: Catch missing build-deps
run: |
apt-get update && apt-get build-dep . -y
- name: Build binary package
if: github.event_name == 'pull_request'
run: |
dpkg-buildpackage -us -uc -b
mkdir -p build-output
mv ../*.deb build-output/ || true
mv ../*.buildinfo build-output/ || true
mv ../*.changes build-output/ || true
- name: Build source package
if: github.event_name != 'pull_request'
run: |
dpkg-buildpackage -us -uc -S -sa
mkdir -p source-output
mv ../*.dsc source-output/ || true
mv ../*.tar.* source-output/ || true
mv ../*.changes source-output/ || true
mv ../*.buildinfo source-output/ || true
- name: Upload Debian package
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: lemonade-${{ matrix.deb_codename }}-deb
path: build-output/*.deb
retention-days: 30
- name: Upload source package
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: lemonade-${{ matrix.deb_codename }}-source-package
path: source-output/*
retention-days: 30
upload-stable:
name: Upload (Stable)
strategy:
matrix: ${{ fromJSON(needs.prepare-matrix.outputs.package_matrix) }}
needs: [prepare-matrix, package]
permissions:
contents: read
if: ${{ startsWith(github.ref, 'refs/tags/v') && github.event_name != 'pull_request' }}
uses: ./.github/workflows/upload.yml
with:
target: ppa:lemonade-team/stable
artifact: lemonade-${{ matrix.deb_codename }}-source-package
secrets: inherit
upload-bleeding-edge:
name: Upload (Bleeding Edge)
strategy:
matrix: ${{ fromJSON(needs.prepare-matrix.outputs.package_matrix) }}
needs: [prepare-matrix, package]
permissions:
contents: read
if: ${{ !startsWith(github.ref, 'refs/tags/v') && github.event_name != 'pull_request' }}
uses: ./.github/workflows/upload.yml
with:
target: ppa:lemonade-team/bleeding-edge
artifact: lemonade-${{ matrix.deb_codename }}-source-package
secrets: inherit