-
Notifications
You must be signed in to change notification settings - Fork 8
133 lines (115 loc) · 3.69 KB
/
Copy pathrelease.yml
File metadata and controls
133 lines (115 loc) · 3.69 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
# Release workflow for linuxmuster-base7
#
# Usage: Copy this file into the linuxmuster-base7 repository:
# .github/workflows/release.yml
#
# Version and target distribution are read automatically from the first line
# of debian/changelog. Example:
# linuxmuster-base7 (7.3.5-0) lmn73; urgency=medium
#
# Required repository secrets:
# REPO_SSH_KEY GitHub SSH key for the linuxmuster/deb repository
#
# thomas@linuxmuster.net
# 20260427
name: Release
on:
push:
tags:
- 'v[0-9]*'
workflow_dispatch:
jobs:
resolve:
runs-on: ubuntu-latest
outputs:
image: ${{ steps.image.outputs.image }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Select runner image
id: image
run: |
DIST=$(dpkg-parsechangelog -S Distribution)
NUM="${DIST#lmn}"
if [ "${NUM:-0}" -ge 74 ] 2>/dev/null; then
echo "image=ghcr.io/linuxmuster/lmndev-runner:latest" >> "$GITHUB_OUTPUT"
else
echo "image=ghcr.io/linuxmuster/lmndev-runner:24.04" >> "$GITHUB_OUTPUT"
fi
build:
needs: resolve
runs-on: ubuntu-latest
container:
image: ${{ needs.resolve.outputs.image }}
options: --user root
outputs:
version: ${{ steps.meta.outputs.version }}
distribution: ${{ steps.meta.outputs.distribution }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: build
- name: Read version and distribution from debian/changelog
id: meta
working-directory: build
run: |
echo "version=$(dpkg-parsechangelog -S Version)" >> "$GITHUB_OUTPUT"
echo "distribution=$(dpkg-parsechangelog -S Distribution)" >> "$GITHUB_OUTPUT"
- name: Build package
run: /opt/lmndev/build/linuxmuster-base7.sh
env:
OUTPUT_DIR: ${{ github.workspace }}/output
- name: Upload packages as artifacts
uses: actions/upload-artifact@v4
with:
name: packages
path: output/
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download packages
uses: actions/download-artifact@v4
with:
name: packages
path: packages/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.build.outputs.version }}
files: packages/*.deb
generate_release_notes: true
publish:
needs: [build, release]
runs-on: ubuntu-latest
steps:
- name: Download packages
uses: actions/download-artifact@v4
with:
name: packages
path: packages/
- name: Clone archive repository
uses: actions/checkout@v4
with:
repository: linuxmuster/deb
ssh-key: ${{ secrets.REPO_SSH_KEY }}
path: deb
- name: Publish packages (${{ needs.build.outputs.distribution }})
run: |
PACKAGE="linuxmuster-base7"
DISTRIBUTION="${{ needs.build.outputs.distribution }}"
VERSION="${{ needs.build.outputs.version }}"
BRANCH="$(echo "$PACKAGE-$DISTRIBUTION-$VERSION" | sed 's/~/tilde/')"
mkdir -p "deb/packages/$PACKAGE/$DISTRIBUTION"
rm -rf "deb/packages/$PACKAGE/$DISTRIBUTION/"*
cp packages/* "deb/packages/$PACKAGE/$DISTRIBUTION/"
cd deb
git config user.name github-actions
git config user.email github-actions@github.com
git checkout -b "update/$BRANCH"
git add .
git commit -m "Update $PACKAGE/$DISTRIBUTION to $VERSION (by GitHub Actions)"
git push --set-upstream origin "update/$BRANCH"