Initial release
This commit is contained in:
commit
1b1816d4db
91 files changed
+14164
No files matched your search
@@ -0,0 +1,142 @@
|
||||
name: Build tagged release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*.*.*"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: Three-part release version, for example 0.1.0
|
||||
required: true
|
||||
default: 0.1.0
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
metadata:
|
||||
name: Validate version
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- id: version
|
||||
name: Validate three-part version
|
||||
shell: bash
|
||||
env:
|
||||
RAW_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.version || github.ref_name }}
|
||||
run: |
|
||||
version="${RAW_VERSION#v}"
|
||||
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Tag must be a three-part version such as v1.2.3 or 1.2.3" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
root_version=$(node -p "require('./package.json').version")
|
||||
frontend_version=$(node -p "require('./frontend/package.json').version")
|
||||
worker_version=$(awk -F '"' '/^version = / { print $2; exit }' Cargo.toml)
|
||||
agent_version=$(awk -F '"' '/^version = / { print $2; exit }' agent/Cargo.toml)
|
||||
for package_version in "$root_version" "$frontend_version" "$worker_version" "$agent_version"; do
|
||||
if [ "$package_version" != "$version" ]; then
|
||||
echo "Tag version $version does not match package version $package_version" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
agent:
|
||||
name: Agent (${{ matrix.platform }})
|
||||
needs: metadata
|
||||
runs-on: ${{ matrix.runner }}
|
||||
env:
|
||||
CARGO_TARGET_DIR: target/agent
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- platform: Linux x86_64
|
||||
runner: ubuntu-latest
|
||||
target: x86_64-unknown-linux-gnu
|
||||
asset: agent-linux-x86_64
|
||||
extension: ""
|
||||
cross: true
|
||||
- platform: Linux ARM64
|
||||
runner: ubuntu-latest
|
||||
target: aarch64-unknown-linux-gnu
|
||||
asset: agent-linux-aarch64
|
||||
extension: ""
|
||||
cross: true
|
||||
- platform: Windows x86_64
|
||||
runner: windows-latest
|
||||
target: x86_64-pc-windows-msvc
|
||||
asset: agent-windows-x86_64.exe
|
||||
extension: .exe
|
||||
cross: false
|
||||
- platform: macOS ARM64
|
||||
runner: macos-14
|
||||
target: aarch64-apple-darwin
|
||||
asset: agent-macos-aarch64
|
||||
extension: ""
|
||||
cross: false
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.target }}
|
||||
- name: Install Linux cross compiler
|
||||
if: matrix.cross
|
||||
run: cargo install cross --version 0.2.5 --locked
|
||||
- name: Build Rust Agent with cross
|
||||
if: matrix.cross
|
||||
run: cross build --manifest-path agent/Cargo.toml --release --locked --target ${{ matrix.target }}
|
||||
- name: Build Rust Agent with Cargo
|
||||
if: matrix.cross == false
|
||||
run: cargo build --manifest-path agent/Cargo.toml --release --locked --target ${{ matrix.target }}
|
||||
- name: Stage Agent binary
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p release
|
||||
cp "target/agent/${{ matrix.target }}/release/cf-monitor-agent${{ matrix.extension }}" "release/${{ matrix.asset }}"
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.asset }}
|
||||
path: release/${{ matrix.asset }}
|
||||
if-no-files-found: error
|
||||
|
||||
frontend:
|
||||
name: Frontend
|
||||
needs: metadata
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: 1.3.14
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile
|
||||
- name: Build public frontend
|
||||
run: bun run --cwd frontend build:public
|
||||
- name: Package frontend
|
||||
run: tar -czf "cf-monitor-frontend-${{ needs.metadata.outputs.version }}.tar.gz" -C frontend/dist .
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: frontend
|
||||
path: cf-monitor-frontend-${{ needs.metadata.outputs.version }}.tar.gz
|
||||
if-no-files-found: error
|
||||
|
||||
release:
|
||||
name: Publish GitHub Release
|
||||
if: github.event_name == 'push'
|
||||
needs: [metadata, agent, frontend]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: release-assets
|
||||
merge-multiple: true
|
||||
- uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
generate_release_notes: true
|
||||
files: release-assets/**
|
||||
Reference in new issue
Block a user