-
Notifications
You must be signed in to change notification settings - Fork 21
168 lines (144 loc) · 5.24 KB
/
build_release_artifacts.yaml
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
# This workflow will build a golang project
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Build exporter deb,rpm and tgz artifacts
on:
push:
# branches: [master]
# TODO this combination logic of branch + tag is not working.
tags:
- v*
permissions:
id-token: write
actions: write
contents: write
jobs:
job_build:
strategy:
fail-fast: false
matrix:
arch: ["amd64","arm64"]
container: ["ubuntu:20.04","ubuntu:22.04","redhat:8","redhat:9","amazonlinux:2023","debian:11","debian:12"]
include:
- container: "ubuntu:22.04"
name: "Ubuntu22.04"
cmd: "make deb"
ext: "deb"
- container: "ubuntu:20.04"
name: "Ubuntu20.04"
cmd: "make deb"
ext: "deb"
- container: "redhat:8"
cmd: "make rpm"
ext: "rpm"
- container: "redhat:9"
cmd: "make rpm"
ext: "rpm"
- container: "amazonlinux:2023"
cmd: "make rpm"
ext: "rpm"
- container: "debian:11"
cmd: "make deb"
ext: "deb"
- container: "debian:12"
cmd: "make deb"
ext: "deb"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/${{ matrix.arch }}
- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to JFrog
uses: docker/login-action@v2
with:
registry: aerospike.jfrog.io
username: ${{ secrets.JFROG_ARTIFACTORY_USER }}
password: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }}
- name: Build OS and Platform specific artifact
id: build-artifact
run: |
docker run -v ${{ github.workspace }}:/src/ -w /src/ --platform linux/${{ matrix.arch }} aerospike.jfrog.io/devops-containers-prod-local/fpm-${{ matrix.container }} ${{ matrix.cmd }}
- name: Upload Release Asset
env:
GH_TOKEN: ${{ github.token }}
TAG_NAME: "${{ steps.get-latest-tag.outputs.tag }}"
run: |
# echo "tag_name $TAG_NAME"
echo
files=$(find pkg/target -type f -name "aerospike-prome*" -printf "$(realpath -s %p) ")
for file in $files; do
echo "uploading file === $file to release-tag $TAG_NAME"
gh release upload "$TAG_NAME" "$file"
done
echo
echo "lising of files ... "
echo
ls -lst pkg/target/*
tar_job:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
- uses: actions/setup-ruby@v1
with:
ruby-version: '3.x'
- run: gem install fpm --no-document
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.20.2
- name: go mod tidy
run: |
dpkg-architecture -q DEB_BUILD_ARCH
(git describe --tags --always --abbrev=0 | cut -c 1-)
go mod tidy
- name: Build tar files
id: build-tar-artifact
run: |
echo "Current working directory ".$PWD
echo
echo "Build Directory is ".$BUILD_DIR
make tar GOOS=linux GOARCH=amd64 ARCH=x86_64
make tar GOOS=linux GOARCH=arm64 ARCH=aarch64
- name: gzip tar files
run: |
cd pkg/target
ls -lrt *.tar
echo "GZipping tar files"
gzip aerospike-prometheus-exporter*.tar
echo "gzipped files"
ls -lrt *.tar.gz
# find in current folder i.e. pkg/target all files to move as tgz
files=$(find . -type f -name "aerospike-prome*" -printf "$(realpath -s %p) ")
for file in $files; do
echo "gzipping file === $file "
mv "$file" "${file%.tar.gz}.tgz"
done
ls -lrt *.tgz
- name: Upload Release Asset
env:
GH_TOKEN: ${{ github.token }}
TAG_NAME: "${{ steps.get-latest-tag.outputs.tag }}"
run: |
# echo "tag_name $TAG_NAME"
echo
files=$(find pkg/target -type f -name "aerospike-prome*" -printf "$(realpath -s %p) ")
for file in $files; do
echo "uploading file === $file to release-tag $TAG_NAME"
gh release upload "$TAG_NAME" "$file"
done
echo
echo "lising of files ... "
echo
ls -lst pkg/target/*