.github/workflows/build.yml #112
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@v3 | |
with: | |
name: statshouse-${{needs.env.outputs.version}}-ui | |
path: | | |
statshouse-ui/build | |
.dummy_preserves_directory_structure | |
outputs: | |
artifact: statshouse-${{needs.env.outputs.version}}-ui | |
almalinux: | |
needs: [env, frontend] | |
uses: ./.github/workflows/build_rpm.yml | |
with: | |
ref: ${{needs.env.outputs.ref}} | |
ref_timestamp: ${{needs.env.outputs.ref_timestamp}} | |
timestamp: ${{needs.env.outputs.timestamp}} | |
version: ${{needs.env.outputs.version}} | |
name: almalinux | |
release: 9.2 | |
frontend-artifact: ${{needs.frontend.outputs.artifact}} | |
secrets: inherit | |
debian: | |
if: ${{false}} | |
strategy: | |
matrix: | |
release: [buster, bullseye] | |
needs: [env, frontend] | |
uses: ./.github/workflows/build_deb.yml | |
with: | |
container_json: '{"image":"golang:1.19-${{matrix.release}}"}' | |
ref: ${{needs.env.outputs.ref}} | |
ref_timestamp: ${{needs.env.outputs.ref_timestamp}} | |
timestamp: ${{needs.env.outputs.timestamp}} | |
version: ${{needs.env.outputs.version}} | |
name: 'debian' | |
release: ${{matrix.release}} | |
frontend-artifact: ${{needs.frontend.outputs.artifact}} | |
secrets: inherit | |
ubuntu_jammy: | |
if: ${{false}} | |
needs: [env, frontend] | |
uses: ./.github/workflows/build_deb.yml | |
with: | |
runs-on: ubuntu-22.04 | |
setup-go: true | |
ref: ${{needs.env.outputs.ref}} | |
ref_timestamp: ${{needs.env.outputs.ref_timestamp}} | |
timestamp: ${{needs.env.outputs.timestamp}} | |
version: ${{needs.env.outputs.version}} | |
name: ubuntu | |
release: jammy | |
frontend-artifact: ${{needs.frontend.outputs.artifact}} | |
secrets: inherit | |
ubuntu_focal: | |
needs: [env, frontend] | |
uses: ./.github/workflows/build_deb.yml | |
with: | |
runs-on: ubuntu-20.04 | |
setup-go: true | |
ref: ${{needs.env.outputs.ref}} | |
ref_timestamp: ${{needs.env.outputs.ref_timestamp}} | |
timestamp: ${{needs.env.outputs.timestamp}} | |
version: ${{needs.env.outputs.version}} | |
name: ubuntu | |
release: focal | |
frontend-artifact: ${{needs.frontend.outputs.artifact}} | |
secrets: inherit | |
draft_release: | |
if: ${{ github.event.inputs.draft_release }} | |
needs: [env, ubuntu_focal, almalinux] | |
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@master | |
with: | |
name: ${{needs.almalinux.outputs.artifact}} | |
path: pkg/rpm | |
- uses: actions/download-artifact@master | |
if: ${{false}} | |
with: | |
name: ${{needs.debian.outputs.artifact}} | |
path: pkg/deb | |
- uses: actions/download-artifact@master | |
with: | |
name: ${{needs.ubuntu_focal.outputs.artifact}} | |
path: pkg/deb | |
- run: gh release create --verify-tag --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}} |