-
Notifications
You must be signed in to change notification settings - Fork 23
130 lines (130 loc) · 4.53 KB
/
build.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
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to build'
required: true
draft_release:
description: 'Draft a release'
required: false
default: true
jobs:
env:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: VKCOM/statshouse
ref: ${{ github.event.inputs.tag }}
fetch-depth: 0
- id: main
run: |
BUILD_COMMIT=$(git log --format="%H" -n 1)
BUILD_COMMIT_TS=$(git log --format="%ct" -n 1)
BUILD_TIME=$(date +%FT%T%z)
BUILD_VERSION=$(git describe --tags --always --dirty)
BUILD_VERSION=${BUILD_VERSION#v}
echo "BUILD_COMMIT=$BUILD_COMMIT" >> "$GITHUB_OUTPUT"
echo "BUILD_COMMIT_TS=$BUILD_COMMIT_TS" >> "$GITHUB_OUTPUT"
echo "BUILD_TIME=$BUILD_TIME" >> "$GITHUB_OUTPUT"
echo "BUILD_VERSION=$BUILD_VERSION" >> "$GITHUB_OUTPUT"
outputs:
ref: ${{ steps.main.outputs.BUILD_COMMIT }}
ref_timestamp: ${{ steps.main.outputs.BUILD_COMMIT_TS }}
timestamp: ${{ steps.main.outputs.BUILD_TIME }}
version: ${{ steps.main.outputs.BUILD_VERSION }}
frontend:
needs: env
runs-on: ubuntu-latest
container:
image: node:18
steps:
- uses: actions/checkout@v4
with:
repository: VKCOM/statshouse
ref: ${{needs.env.outputs.ref}}
fetch-depth: 0
- run: echo "REACT_APP_BUILD_VERSION=${{needs.env.outputs.version}}-${{needs.env.outputs.timestamp}}" >> $GITHUB_ENV
- run: make build-sh-ui
- uses: actions/upload-artifact@v4
with:
name: statshouse-ui-${{needs.env.outputs.version}}
path: |
statshouse-ui/build
.dummy_preserves_directory_structure
outputs:
artifact: statshouse-ui-${{needs.env.outputs.version}}
rpm:
strategy:
matrix:
image: ["centos:centos7", "almalinux:9"]
needs: [env, frontend]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: VKCOM/statshouse
ref: ${{needs.env.outputs.ref}}
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: ${{needs.frontend.outputs.artifact}}
- run: echo "BUILD_VERSION=`echo ${{needs.env.outputs.version}} | sed -e 's:-:.:g'`" >> $GITHUB_ENV
- run: build/makerpm.sh ${{matrix.image}}
- uses: actions/upload-artifact@v4
with:
name: statshouse-pkg-rpm-${{needs.env.outputs.version}}${{strategy.job-index}}
path: RPMS/*.rpm
debian:
strategy:
matrix:
release: [bullseye, bookworm]
needs: [env, frontend]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: VKCOM/statshouse
ref: ${{needs.env.outputs.ref}}
fetch-depth: 0
- run: echo "BUILD_VERSION=`echo ${{needs.env.outputs.version}} | sed -e 's:-:.:g'`" >> $GITHUB_ENV
- run: build/make-pkg.sh debian-${{matrix.release}}
- uses: actions/upload-artifact@v4
with:
name: statshouse-pkg-debian-${{inputs.version}}${{github.run_number}}${{strategy.job-index}}
path: target/debian-${{matrix.release}}/*.deb
ubuntu:
strategy:
matrix:
release: [focal, jammy]
needs: [env, frontend]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: VKCOM/statshouse
ref: ${{needs.env.outputs.ref}}
fetch-depth: 0
- run: echo "BUILD_VERSION=`echo ${{needs.env.outputs.version}} | sed -e 's:-:.:g'`" >> $GITHUB_ENV
- run: build/make-pkg.sh ubuntu-${{matrix.release}}
- uses: actions/upload-artifact@v4
with:
name: statshouse-pkg-ubuntu-${{inputs.version}}${{github.run_number}}${{strategy.job-index}}
path: target/ubuntu-${{matrix.release}}/*.deb
draft_release:
if: ${{ github.event.inputs.draft_release }}
needs: [env, rpm, ubuntu, debian]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: VKCOM/statshouse
ref: ${{needs.env.outputs.ref}}
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
pattern: statshouse-pkg-*
path: pkg/
- run: gh release create --draft --generate-notes --title "${{github.event.inputs.tag}}" ${{github.event.inputs.tag}} $(find ./pkg -type f -name *.deb -o -name *.rpm)
env:
GITHUB_TOKEN: ${{secrets.DEVTOOLS_GITHUB_TOKEN}}