-
Notifications
You must be signed in to change notification settings - Fork 488
130 lines (121 loc) · 4.69 KB
/
package.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
name: build packages
on:
push:
tags:
- "v*"
branches: [ POLARDB_15_STABLE ]
pull_request:
branches: [ POLARDB_15_STABLE ]
paths:
- '.github/workflows/package.yml'
- 'config/**'
- 'contrib/**'
- 'external/**'
- 'package/**'
- 'src/**'
- 'configure*'
- 'build.sh'
# trigger testing manually
workflow_dispatch:
jobs:
build-and-publish-rpm:
strategy:
matrix:
arch: [ ubuntu-24.04, ubuntu-24.04-arm ]
base_image: [ anolis8, rocky8, rocky9 ]
runs-on: ${{ matrix.arch }}
steps:
- name: fetch source code
uses: actions/checkout@v4
- name: create and start the container
run: |
docker create \
-t \
--name polardb_${{ matrix.base_image }} \
-v `pwd`:/home/postgres/PolarDB-for-PostgreSQL \
polardb/polardb_pg_devel:${{ matrix.base_image }} \
bash && \
docker start polardb_${{ matrix.base_image }}
- name: build RPM package
run: |
docker exec \
polardb_${{ matrix.base_image }} \
bash -c "cd /home/postgres/PolarDB-for-PostgreSQL && \
sudo chown -R postgres:postgres ./ && \
cd ./package/rpm && \
if [ -f /etc/bashrc ]; then source /etc/bashrc; fi && \
./build-rpm.sh"
- name: get package name
run: |
RPMPATH=./package/rpm/`uname -m` && \
cd $RPMPATH && \
RPMNAME=`ls` && \
echo "rpmname=$RPMNAME" >> $GITHUB_ENV
echo "rpmpath=$RPMPATH/$RPMNAME" >> $GITHUB_ENV
- name: upload artifact
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: ${{ env.rpmname }}
path: ${{ env.rpmpath }}
compression-level: 0
- name: change ownership of the source code
run: |
sudo chown -R runner:runner `pwd`
build-and-publish-deb:
strategy:
matrix:
arch: [ ubuntu-24.04, ubuntu-24.04-arm ]
base_image: [ ubuntu20.04, ubuntu22.04, ubuntu24.04, debian11, debian12 ]
runs-on: ${{ matrix.arch }}
steps:
- name: fetch source code
uses: actions/checkout@v4
- name: create and start the container
run: |
docker create \
-t \
--name polardb_${{ matrix.base_image }} \
-v `pwd`:/home/postgres/PolarDB-for-PostgreSQL \
polardb/polardb_pg_devel:${{ matrix.base_image }} \
bash && \
docker start polardb_${{ matrix.base_image }}
- name: build deb package
run: |
docker exec \
polardb_${{ matrix.base_image }} \
bash -c "cd /home/postgres/PolarDB-for-PostgreSQL && \
sudo chown -R postgres:postgres ./ && \
cd ./package/debian && \
if [ -f /etc/bashrc ]; then source /etc/bashrc; fi && \
./build-deb.sh"
- name: get package name
run: |
cd ./package/debian && DEBNAME=`ls *.deb` && echo "debname=$DEBNAME" >> $GITHUB_ENV
- name: upload artifact
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: ${{ env.debname }}
path: ./package/debian/${{ env.debname }}
compression-level: 0
- name: change ownership of the source code
run: |
sudo chown -R runner:runner `pwd`
release-packages:
if: startsWith(github.ref, 'refs/tags/')
needs: [ build-and-publish-rpm, build-and-publish-deb ]
runs-on: ubuntu-latest
steps:
- name: download all artifacts
uses: actions/download-artifact@v4
with:
pattern: |
*.{rpm,deb}
merge-multiple: true
- name: upload artifacts to release
uses: softprops/action-gh-release@v2
with:
files: |
*.rpm
*.deb