-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (94 loc) · 3.07 KB
/
release.yml
File metadata and controls
111 lines (94 loc) · 3.07 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
# Release workflow for linuxmuster-common
#
# Usage: Copy this file into the linuxmuster-common repository:
# .github/workflows/release.yml
#
# Version and target distribution are read automatically from the first line
# of debian/changelog. Example:
# linuxmuster-common (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:
build:
runs-on: ubuntu-latest
container:
image: ghcr.io/linuxmuster/lmndev-runner:latest
options: --user root
outputs:
version: ${{ steps.meta.outputs.version }}
distribution: ${{ steps.meta.outputs.distribution }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Read version and distribution from debian/changelog
id: meta
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-common.sh
env:
OUTPUT_DIR: ${{ github.workspace }}/packages
- name: Upload packages as artifacts
uses: actions/upload-artifact@v4
with:
name: packages
path: packages/
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-common"
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"