-
Notifications
You must be signed in to change notification settings - Fork 63
168 lines (142 loc) · 5.48 KB
/
release.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
name: Release
# N.B.: build steps should match the tests we run in ci.yml
on:
create
jobs:
build:
# Use older Ubuntu release to avoid building with a too new glibc, which will cause
# errors on older distributions, if anyone uses the generated binary directly.
runs-on: ubuntu-20.04
permissions: {}
# ensure we don't release on create events for branches (only tags)
if: ${{ startsWith( github.ref, 'refs/tags' ) }}
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: 1.21
id: go
- name: Set up protoc
uses: pganalyze/setup-protoc@ab6203da1c3118e4406048171b09238ad31ad73e
with:
version: 3.14.0
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check out code
uses: actions/checkout@v3
with:
submodules: true
- name: Runs tests
run: |
make build OUTFILE=pganalyze-collector-linux-amd64
make test
DOCKER_BUILDKIT=1 make integration_test
- name: Upload build
uses: actions/upload-artifact@v2
with:
name: pganalyze-collector-linux-amd64
path: pganalyze-collector-linux-amd64
build_packages:
# Use older Ubuntu release to ensure availability of CGroupsv1 (which are necessary
# currently to support older systemd on some of the test containers)
runs-on: ubuntu-20.04
permissions: {}
# ensure we don't release on create events for branches (only tags)
if: ${{ startsWith( github.ref, 'refs/tags' ) }}
steps:
- name: Check out code
uses: actions/checkout@v3
with:
submodules: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Build packages
run: |
DOCKER_BUILDKIT=1 make -C packages build
- name: Test packages
run: |
DOCKER_BUILDKIT=1 make -C packages test
- name: Upload packages as artifacts
uses: actions/upload-artifact@v3
with:
name: packages
path: |
packages/tmp/pganalyze-collector-*.aarch64.rpm
packages/tmp/pganalyze-collector-*.x86_64.rpm
packages/tmp/pganalyze-collector_*_amd64.deb
packages/tmp/pganalyze-collector_*_arm64.deb
if-no-files-found: error
release:
needs: [build, build_packages]
runs-on: ubuntu-latest
# ensure we don't release on create events for branches (only tags)
if: ${{ startsWith( github.ref, 'refs/tags' ) }}
steps:
- name: Download build
uses: actions/download-artifact@v3
with:
name: pganalyze-collector-linux-amd64
- name: Download build packages
uses: actions/download-artifact@v3
with:
name: packages
- name: Get version and git version from tag
id: get_version
run: |
echo "git_version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.git_version }}
release_name: ${{ steps.get_version.outputs.git_version }}
draft: false
prerelease: false
- name: Upload release build
id: upload-release-build
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./pganalyze-collector-linux-amd64
asset_name: pganalyze-collector-linux-amd64
asset_content_type: application/octet-stream
- name: Upload release build package (RPM, x86-64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./pganalyze-collector-${{ steps.get_version.outputs.version }}-1.x86_64.rpm
asset_name: pganalyze-collector-${{ steps.get_version.outputs.version }}-1.x86_64.rpm
asset_content_type: application/octet-stream
- name: Upload release build package (RPM, arm64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./pganalyze-collector-${{ steps.get_version.outputs.version }}-1.aarch64.rpm
asset_name: pganalyze-collector-${{ steps.get_version.outputs.version }}-1.aarch64.rpm
asset_content_type: application/octet-stream
- name: Upload release build package (DEB, x86-64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./pganalyze-collector_${{ steps.get_version.outputs.version }}_amd64.deb
asset_name: pganalyze-collector_${{ steps.get_version.outputs.version }}_amd64.deb
asset_content_type: application/octet-stream
- name: Upload release build package (DEB, arm64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./pganalyze-collector_${{ steps.get_version.outputs.version }}_arm64.deb
asset_name: pganalyze-collector_${{ steps.get_version.outputs.version }}_arm64.deb
asset_content_type: application/octet-stream