forked from erigontech/erigon
-
Notifications
You must be signed in to change notification settings - Fork 45
139 lines (126 loc) · 6.41 KB
/
reusable-release-build-debian-pkg.yml
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
name: Build debian package (part of release process)
on:
workflow_call:
inputs:
application:
required: true
type: string
version:
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Download arm64 artifact
uses: actions/download-artifact@v4
with:
name: ${{ inputs.application }}_v${{ inputs.version }}_linux_arm64.tar.gz
- name: Download amd64v2 artifact
uses: actions/download-artifact@v4
with:
name: ${{ inputs.application }}_v${{ inputs.version }}_linux_amd64v2.tar.gz
- name: Update and install required packages, run dpkg
run: |
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y dpkg-dev debhelper
sudo dpkg --clear-avail
- name: Extract archives and rename amd64v2 to amd64
run: |
tar xzvf ${{ inputs.application }}_v${{ inputs.version }}_linux_amd64v2.tar.gz
mv -v ${{ inputs.application }}_v${{ inputs.version }}_linux_amd64v2 ${{ inputs.application }}_v${{ inputs.version }}_linux_amd64
tar xzvf ${{ inputs.application }}_v${{ inputs.version }}_linux_arm64.tar.gz
cat <<-END > postinst.template
#!/bin/bash
echo "WARNING: erigon package does not install any configurations nor services."
echo "Use your specific way to configure and run erigon according to your needs."
echo "More details on how to run erigon could be found at https://erigon.gitbook.io/erigon ."
END
# Creating directory structure
# see https://www.debian.org/doc/debian-policy/ch-controlfields.html#version
# https://www.debian.org/doc/manuals/developers-reference/best-pkging-practices.html
- name: Build debian package for amd64
env:
ARCH: "amd64"
run: |
mkdir -p deb-pkg/${{ inputs.application }}_${{ inputs.version }}_${ARCH}/usr/bin \
deb-pkg/${{ inputs.application }}_${{ inputs.version }}_${ARCH}/DEBIAN
install postinst.template deb-pkg/${{ inputs.application }}_${{ inputs.version }}_${ARCH}/DEBIAN/postinst
cat <<-END > deb-pkg/${{ inputs.application }}_${{ inputs.version }}_${ARCH}/DEBIAN/control
Package: ${{ inputs.application }}
Version: ${{ inputs.version }}
Section: misc
Priority: optional
Architecture: ${ARCH}
Maintainer: Erigon DevOps [https://github.com/erigontech/erigon/issues]
Description: Erigon - Ethereum implementation on the efficiency frontier
Vcs-Git: https://github.com/erigontech/erigon.git
Vcs-Browser: https://github.com/erigontech/erigon
END
install -v -p ${{ inputs.application }}_v${{ inputs.version }}_linux_${ARCH}/* \
deb-pkg/${{ inputs.application }}_${{ inputs.version }}_${ARCH}/usr/bin
dpkg-deb --build --root-owner-group deb-pkg/${{ inputs.application }}_${{ inputs.version }}_${ARCH}
- name: Build debian package for arm64
env:
ARCH: "arm64"
run: |
mkdir -p deb-pkg/${{ inputs.application }}_${{ inputs.version }}_${ARCH}/usr/bin \
deb-pkg/${{ inputs.application }}_${{ inputs.version }}_${ARCH}/DEBIAN
install postinst.template deb-pkg/${{ inputs.application }}_${{ inputs.version }}_${ARCH}/DEBIAN/postinst
cat <<-END > deb-pkg/${{ inputs.application }}_${{ inputs.version }}_${ARCH}/DEBIAN/control
Package: ${{ inputs.application }}
Version: ${{ inputs.version }}
Section: misc
Priority: optional
Architecture: ${ARCH}
Maintainer: Erigon DevOps [https://github.com/erigontech/erigon/issues]
Description: Erigon - Ethereum implementation on the efficiency frontier
Vcs-Git: https://github.com/erigontech/erigon.git
Vcs-Browser: https://github.com/erigontech/erigon
END
echo "debug start"
cat deb-pkg/${{ inputs.application }}_${{ inputs.version }}_${ARCH}/DEBIAN/control
echo "debug end"
install -v -p ${{ inputs.application }}_v${{ inputs.version }}_linux_${ARCH}/* \
deb-pkg/${{ inputs.application }}_${{ inputs.version }}_${ARCH}/usr/bin
dpkg-deb --build --root-owner-group deb-pkg/${{ inputs.application }}_${{ inputs.version }}_${ARCH}
- name: Debug output
run: |
cd ./deb-pkg
sha256sum ${{ inputs.application }}_${{ inputs.version }}_amd64.deb > ${{ inputs.application }}_${{ inputs.version }}_amd64.deb.checksum
sha256sum ${{ inputs.application }}_${{ inputs.version }}_arm64.deb > ${{ inputs.application }}_${{ inputs.version }}_arm64.deb.checksum
ls -l *deb *.checksum
- name: Apload artifact amd64.deb
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a ## v4.3.6
with:
name: ${{ inputs.application }}_${{ inputs.version }}_amd64.deb
path: ./deb-pkg/${{ inputs.application }}_${{ inputs.version }}_amd64.deb
retention-days: 5
compression-level: 0
if-no-files-found: error
- name: Apload artifact amd64.deb.checksum
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a ## v4.3.6
with:
name: ${{ inputs.application }}_${{ inputs.version }}_amd64.deb.checksum
path: ./deb-pkg/${{ inputs.application }}_${{ inputs.version }}_amd64.deb.checksum
retention-days: 5
compression-level: 0
if-no-files-found: error
- name: Apload artifact arm64.deb
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a ## v4.3.6
with:
name: ${{ inputs.application }}_${{ inputs.version }}_arm64.deb
path: ./deb-pkg/${{ inputs.application }}_${{ inputs.version }}_arm64.deb
retention-days: 5
compression-level: 0
if-no-files-found: error
- name: Apload artifact arm64.deb.checksum
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a ## v4.3.6
with:
name: ${{ inputs.application }}_${{ inputs.version }}_arm64.deb.checksum
path: ./deb-pkg/${{ inputs.application }}_${{ inputs.version }}_arm64.deb.checksum
retention-days: 5
compression-level: 0
if-no-files-found: error