-
Notifications
You must be signed in to change notification settings - Fork 27
153 lines (145 loc) · 5.34 KB
/
reuseable_build_package.yaml
File metadata and controls
153 lines (145 loc) · 5.34 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: "Build Token Plugin Package"
on:
workflow_call:
inputs:
GITHUB_REPOSITORY_NAME:
required: true
type: string
UBUNTU_VERSION:
required: true
type: string
isDev:
required: false
default: true
type: boolean
jobs:
timestamp:
name: Get timestamp
runs-on: ubuntu-latest
outputs:
timestamp: ${{ steps.timestamp.outputs.timestamp }}
steps:
- id: timestamp
run: |
export timestamp=$(date +%s)
echo "timestamp=$timestamp" >> $GITHUB_OUTPUT
echo "::group::DEBUG"
echo "timestamp=$timestamp"
echo "::endgroup::"
build_token_plugin_release:
name: Token Plugin Build Packages
needs: timestamp
runs-on: ubuntu-20.04
container:
image: ghcr.io/${{ inputs.GITHUB_REPOSITORY_NAME }}/token-plugin-build:${{ inputs.UBUNTU_VERSION }}
steps:
- name: adding github workspace as safe directory
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Check out code
uses: actions/checkout@v4
- name: Set Version with UX-timestamp
if: ${{ inputs.isDev }}
run: python3 updateVersion.py --timestamp ${{ needs.timestamp.outputs.timestamp }}
- name: Get current Version
id: version
run: |
version=$(python3 updateVersion.py --getVersion)
debVersion=$(echo $version | sed -r 's/-/~/g')
echo "debVersion=$debVersion">>$GITHUB_OUTPUT
- name: Get indy-node version to depend on
id: node-version
shell: bash
run: |
version=$(grep -oP "\d+.\d+.\d+((-|.)?(rc|dev)\d+)?" <<< $(grep -oP "indy-node==\d+.\d+.\d+((-|.)?(rc|dev)\d+)?" sovtoken/setup.py) || true)
echo $version > indy-node-version.txt
echo "nodeVersion=$(sed 's/\./\~/3' indy-node-version.txt)" >> $GITHUB_OUTPUT
- name: Build Token Plugin deployment package
run: |
mkdir -p /tmp/build-output
# Build the sovtoken package
fpm \
--input-type python \
--output-type deb \
--name sovtoken \
--version ${{ steps.version.outputs.debVersion }} \
--depends "indy-node(=${{ steps.node-version.outputs.nodeVersion }})" \
--architecture amd64 \
--maintainer "Sovrin" \
--verbose \
--no-python-dependencies \
--no-python-fix-name \
--python-bin "/usr/bin/python3" \
--no-python-fix-dependencies \
--exclude "*.pyc" \
--exclude "*.pyo" \
--after-install ./devops/build-scripts/focal/sovtoken/postinst \
--before-remove ./devops/build-scripts/focal/sovtoken/prerm \
--force \
sovtoken/
# Build the sovtokenfees package
fpm \
--input-type python \
--output-type deb \
--name sovtokenfees \
--version ${{ steps.version.outputs.debVersion }} \
--architecture amd64 \
--maintainer "Sovrin" \
--verbose \
--no-python-fix-name \
--python-bin "/usr/bin/python3" \
--no-python-fix-dependencies \
--exclude "*.pyc" \
--exclude "*.pyo" \
--after-install ./devops/build-scripts/focal/sovtokenfees/postinst \
--before-remove ./devops/build-scripts/focal/sovtokenfees/prerm \
--force \
sovtokenfees/
mv ./*.deb /tmp/build-output
- name: Upload sovtoken-deb
uses: actions/upload-artifact@v4
with:
name: sovtoken-deb
path: /tmp/build-output/sovtoken_*.deb
- name: Upload sovtokenfees-deb
uses: actions/upload-artifact@v4
with:
name: sovtokenfees-deb
path: /tmp/build-output/sovtokenfees_*.deb
build_sovtoken_pypi:
name: sovtoken Build Package
runs-on: ubuntu-20.04
needs: timestamp
container:
image: ghcr.io/${{ inputs.GITHUB_REPOSITORY_NAME }}/token-plugin-build:${{ inputs.UBUNTU_VERSION }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set Version with UX-timestamp
if: ${{ inputs.isDev }}
run: python3 updateVersion.py --timestamp ${{ needs.timestamp.outputs.timestamp }}
- name: Build python sovtoken package
run: python3 sovtoken/setup.py sdist --dist-dir /tmp/dist bdist_wheel --dist-dir /tmp/dist
- uses: actions/upload-artifact@v4
with:
name: sovtoken-python
path: /tmp/dist
retention-days: 5
build_sovtokenfees_pypi:
name: sovtokenfees Build Packages
runs-on: ubuntu-20.04
needs: timestamp
container:
image: ghcr.io/${{ inputs.GITHUB_REPOSITORY_NAME }}/token-plugin-build:${{ inputs.UBUNTU_VERSION }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set Version with UX-timestamp
if: ${{ inputs.isDev }}
run: python3 updateVersion.py --timestamp ${{ needs.timestamp.outputs.timestamp }}
- name: Build python sovtokenfees package
run: python3 sovtokenfees/setup.py sdist --dist-dir /tmp/dist bdist_wheel --dist-dir /tmp/dist
- uses: actions/upload-artifact@v4
with:
name: sovtokenfees-python
path: /tmp/dist
retention-days: 5