-
Notifications
You must be signed in to change notification settings - Fork 37
195 lines (172 loc) · 8.64 KB
/
arm_deb_packager.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
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: arm_deb_packager
on:
workflow_dispatch:
release:
types: [released, prereleased]
push:
branches:
- SPEC-161-miden-deployment-fix-from-package
jobs:
build_package:
permissions:
id-token: write
contents: write
outputs:
target: ${{ steps.build_type_vars_setup.outputs.target }}
tag: ${{ steps.build_type_vars_setup.outputs.tag }}
account_id: ${{ steps.build_type_vars_setup.outputs.account_id }}
instance_id: ${{ steps.build_type_vars_setup.outputs.instance_id }}
runs-on:
labels: ubuntu22-arm-4core
steps:
- name: Checkout
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Adding TAG to ENV
run: |
if [[ ${{ github.event_name }} == "release" || ${{ github.event_name }} == "prereleased" ]]; then
echo "GIT_TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV
else
echo "GIT_TAG=next" >> $GITHUB_ENV
fi
- name: adding version
run: |
if [[ ${{ github.event_name }} == "release" || ${{ github.event_name }} == "prereleased" ]]; then
NUMERIC_VERSION=$( echo ${{ env.GIT_TAG }} | sed 's/[^0-9.]//g' )
echo "VERSION=$NUMERIC_VERSION" >> $GITHUB_ENV
else
echo "VERSION=0.1" >> $GITHUB_ENV
fi
- name: cleaning repo
run: cargo clean
- name: Building for arm64
run: |
cargo build --release --locked --features testing --bin miden-node
cargo build --release --locked --features testing --bin miden-faucet
- name: create package directories
run: |
mkdir -p packaging/deb/miden-node/DEBIAN
mkdir -p packaging/deb/miden-node/usr/bin
mkdir -p packaging/deb/miden-node/lib/systemd/system
mkdir -p packaging/deb/miden-node/etc/miden
mkdir -p packaging/deb/miden-node/opt/miden/miden-node
- name: copy package files
run: |
cp -p target/release/miden-node packaging/deb/miden-node/usr/bin/
cp packaging/miden-node.service packaging/deb/miden-node/lib/systemd/system/
cp packaging/postinst packaging/deb/miden-node/DEBIAN/postinst
cp packaging/postrm packaging/deb/miden-node/DEBIAN/postrm
########### Control file creation for arm64 miden-node##########
- name: create control file
run: |
touch packaging/deb/miden-node/DEBIAN/control
echo "Package: miden-node" >> packaging/deb/miden-node/DEBIAN/control
echo "Version: ${{ env.VERSION }}" >> packaging/deb/miden-node/DEBIAN/control
echo "Section: base" >> packaging/deb/miden-node/DEBIAN/control
echo "Priority: optional" >> packaging/deb/miden-node/DEBIAN/control
echo "Architecture: arm64" >> packaging/deb/miden-node/DEBIAN/control
echo "Maintainer: Polygon Devops <[email protected]>" >> packaging/deb/miden-node/DEBIAN/control
echo "Description: miden-node binary package" >> packaging/deb/miden-node/DEBIAN/control
echo "Homepage: https://polygon.technology/polygon-miden" >> packaging/deb/miden-node/DEBIAN/control
echo "Vcs-Git: [email protected]:0xPolygonMiden/miden-node.git" >> packaging/deb/miden-node/DEBIAN/control
echo "Vcs-Browser: https://github.com/0xPolygonMiden/miden-node" >> packaging/deb/miden-node/DEBIAN/control
- name: Creating package for binary for miden-node ${{ env.ARCH }}
run: cp -rp packaging/deb/miden-node packaging/deb/miden-node-${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
ARCH: arm64
- name: Running package build
run: dpkg-deb --build --root-owner-group packaging/deb/miden-node-${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
ARCH: arm64
########## Miden Faucet Package ##########################################
- name: create package directories
run: |
mkdir -p packaging/deb/miden-faucet/DEBIAN
mkdir -p packaging/deb/miden-faucet/usr/bin
mkdir -p packaging/deb/miden-faucet/lib/systemd/system
mkdir -p packaging/deb/miden-faucet/etc/miden
mkdir -p packaging/deb/miden-faucet/opt/miden/miden-faucet
- name: copy package files
run: |
cp -p target/release/miden-faucet packaging/deb/miden-faucet/usr/bin/
cp packaging/miden-faucet.service packaging/deb/miden-faucet/lib/systemd/system/
cp packaging/postinst packaging/deb/miden-faucet/DEBIAN/postinst
cp packaging/postrm.faucet packaging/deb/miden-faucet/DEBIAN/postrm
########### Control file creation for arm64 miden-faucet ##########
- name: create control file
run: |
touch packaging/deb/miden-faucet/DEBIAN/control
echo "Package: miden-faucet" >> packaging/deb/miden-faucet/DEBIAN/control
echo "Version: ${{ env.VERSION }}" >> packaging/deb/miden-faucet/DEBIAN/control
echo "Section: base" >> packaging/deb/miden-faucet/DEBIAN/control
echo "Priority: optional" >> packaging/deb/miden-faucet/DEBIAN/control
echo "Architecture: arm64" >> packaging/deb/miden-faucet/DEBIAN/control
echo "Maintainer: Polygon Devops <[email protected]>" >> packaging/deb/miden-faucet/DEBIAN/control
echo "Description: miden-faucet binary package" >> packaging/deb/miden-faucet/DEBIAN/control
echo "Homepage: https://polygon.technology/polygon-miden" >> packaging/deb/miden-faucet/DEBIAN/control
echo "Vcs-Git: [email protected]:0xPolygonMiden/miden-node.git" >> packaging/deb/miden-faucet/DEBIAN/control
echo "Vcs-Browser: https://github.com/0xPolygonMiden/miden-node" >> packaging/deb/miden-faucet/DEBIAN/control
- name: Creating package for binary for miden-faucet ${{ env.ARCH }}
run: cp -rp packaging/deb/miden-faucet packaging/deb/miden-faucet-${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
ARCH: arm64
- name: Running package build
run: dpkg-deb --build --root-owner-group packaging/deb/miden-faucet-${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
ARCH: arm64
- name: shasum the package
run: cd packaging/deb/ && sha256sum miden-node-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb > miden-node-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb.checksum
env:
ARCH: arm64
- name: shasum the package
run: cd packaging/deb/ && sha256sum miden-faucet-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb > miden-faucet-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb.checksum
env:
ARCH: arm64
- name: release miden-node Packages for testnet
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.GIT_TAG }}
prerelease: true
files: |
packaging/deb/miden-node**.deb
packaging/deb/miden-node**.deb.checksum
packaging/deb/miden-faucet**.deb
packaging/deb/miden-faucet**.deb.checksum
if: ${{ github.event_name == 'release' || github.event_name == 'prereleased' }}
- name: release miden-node Packages for devnet
uses: actions/upload-artifact@v3
with:
name: devnet_package
path: |
packaging/deb/miden-node-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb
packaging/deb/miden-node-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb.checksum
packaging/deb/miden-faucet-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb
packaging/deb/miden-faucet-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb.checksum
env:
ARCH: arm64
if: ${{ github.event_name == 'push' }}
- name: Determine build type
id: build_type_vars_setup
run: |
if [[ ${{ github.event_name }} == "release" || ${{ github.event_name }} == "prereleased" ]]; then
echo "target=testnet" >> $GITHUB_OUTPUT
echo "tag=${{ env.GIT_TAG }}" >> $GITHUB_OUTPUT
echo "account_id=MIDEN_DEV_ACCOUNT_ID" >> $GITHUB_OUTPUT
echo "instance_id=TESTNET_INSTANCE_ID" >> $GITHUB_OUTPUT
else
echo "target=devnet" >> $GITHUB_OUTPUT
echo "tag=next" >> $GITHUB_OUTPUT
echo "account_id=MIDEN_DEV_ACCOUNT_ID" >> $GITHUB_OUTPUT
echo "instance_id=DEVNET_INSTANCE_TF" >> $GITHUB_OUTPUT
fi
deploy:
name: Deploy to ${{ needs.build_package.outputs.target }}
needs: build_package
uses: ./.github/workflows/deploy_package.yml
with:
target: ${{ needs.build_package.outputs.target }}
tag: ${{ needs.build_package.outputs.tag }}
account_id: ${{ needs.build_package.outputs.account_id }}
instance_id: ${{ needs.build_package.outputs.instance_id }}
secrets: inherit