-
-
Notifications
You must be signed in to change notification settings - Fork 56
103 lines (101 loc) · 3.25 KB
/
build_release.yaml
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
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
debian_version: [bullseye, bookworm]
docker_arch: [amd64, arm32v7, arm64v8]
build_type: [generic, raspi]
exclude:
- docker_arch: amd64
build_type: raspi
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Set GIT_VERSION
shell: bash
run: |
majorVer=$(cat VERSION)
lastVer=$(git tag --sort version:refname --list "v$majorVer.*" | tail -n1)
if [[ -n "$lastVer" ]]; then
newVer=(${lastVer//./ })
newVer[-1]="$((${newVer[-1]}+1))"
nextVer="${newVer[*]}"
nextVer="${nextVer// /.}"
else
nextVer="v$majorVer.0"
fi
echo "MajorVer=$majorVer LastVer=$lastVer NextVer=$nextVer"
echo "GIT_VERSION=${nextVer//v/}" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Build Dockerfile
run: docker build --target deb_make --tag deb_make --file .github/ci/Dockerfile --build-arg GIT_VERSION --build-arg DOCKER_ARCH --build-arg DEBIAN_VERSION --build-arg BUILD_TYPE .
env:
DEBIAN_VERSION: ${{ matrix.debian_version }}
DOCKER_ARCH: ${{ matrix.docker_arch }}/
BUILD_TYPE: ${{ matrix.build_type }}
- name: Create container
run: docker create --name deb_make deb_make
- name: Copy files
run: 'docker cp deb_make:/deb/. deb/'
- name: 'Release debian files'
uses: ncipollo/release-action@v1
with:
tag: "v${{ env.GIT_VERSION }}"
artifacts: "deb/*.deb"
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
updateOnlyUnreleased: true
draft: true
publish:
runs-on: ubuntu-latest
permissions:
contents: write
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Set GIT_VERSION
shell: bash
run: |
majorVer=$(cat VERSION)
lastVer=$(git tag --sort version:refname --list "v$majorVer.*" | tail -n1)
if [[ -n "$lastVer" ]]; then
newVer=(${lastVer//./ })
newVer[-1]="$((${newVer[-1]}+1))"
nextVer="${newVer[*]}"
nextVer="${nextVer// /.}"
else
nextVer="v$majorVer.0"
fi
echo "MajorVer=$majorVer LastVer=$lastVer NextVer=$nextVer"
echo "GIT_VERSION=${nextVer//v/}" >> $GITHUB_ENV
- name: Generate RELEASE details
run: |
echo "# Release ${{ env.GIT_VERSION }}" > RELEASE.tmp
echo "" >> RELEASE.tmp
lastReleasedVer=$(git tag --sort version:refname --list "v$majorVer.*" | tail -n1)
git log --pretty="- %s (%h)" "$lastReleasedVer..HEAD" >> RELEASE.tmp
echo "" >> RELEASE.tmp
cat RELEASE.md >> RELEASE.tmp
- name: 'Release debian files'
uses: ncipollo/release-action@v1
with:
tag: "v${{ env.GIT_VERSION }}"
allowUpdates: true
updateOnlyUnreleased: true
generateReleaseNotes: true
prerelease: true
bodyFile: RELEASE.tmp