.github/workflows/build.yml #153
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}} |