Skip to content

Merge branch 'main' of https://github.com/monitio/tread #18

Merge branch 'main' of https://github.com/monitio/tread

Merge branch 'main' of https://github.com/monitio/tread #18

Workflow file for this run

name: Draft Combined Release
on:
push:
branches:
- main
permissions:
contents: write
id-token: write
packages: write
jobs:
build-unix:
name: Build for UNIX
runs-on: ubuntu-latest
steps:
- name: Install Clang
run: sudo apt-get update && sudo apt-get install -y clang
- name: Checkout Repository
uses: actions/checkout@v4
- name: Create dist/gha directory
run: mkdir -p dist/gha
- name: Compile GHA Launcher (UNIX)
run: clang ./src/gha/gha.c -o ./dist/gha/gha
- name: Run GHA Launcher (UNIX Build & Package)
run: ./dist/gha/gha
- name: Upload UNIX Binary Artifact
uses: actions/upload-artifact@v4
with:
name: tread-bin-UNIX
path: ./tread-bin-UNIX.zip
build-windows:
name: Build for Windows
runs-on: windows-latest
steps:
- name: Install Clang via Chocolatey (LLVM)
run: choco install llvm --no-progress --limit-output
shell: powershell
- name: Add Clang to PATH
run: |
$llvmPath = "C:\Program Files\LLVM\bin"
Add-Content -Path $env:GITHUB_PATH -Value $llvmPath
echo "Added $llvmPath to GITHUB_PATH"
shell: powershell
- name: Verify Clang installation
run: clang --version
shell: powershell
- name: Checkout Repository
uses: actions/checkout@v4
- name: Create dist\gha directory
run: mkdir -p dist\gha
shell: powershell
- name: Compile GHA Launcher (Windows)
run: clang ./src/gha/gha.c -o ./dist/gha/gha.exe
shell: powershell
- name: Run GHA Launcher (Windows Build & Package)
run: .\dist\gha\gha.exe
shell: powershell
- name: Upload Windows Binary Artifact
uses: actions/upload-artifact@v4
with:
name: tread-bin-WIN
path: ./tread-bin-WIN.zip
create-release:
name: Create Combined Draft Release
runs-on: ubuntu-latest
# This job depends on both build jobs completing successfully
needs: [build-unix, build-windows]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download UNIX Binary Artifact
uses: actions/download-artifact@v4
with:
name: tread-bin-UNIX
path: ./.
- name: Download Windows Binary Artifact
uses: actions/download-artifact@v4
with:
name: tread-bin-WIN
path: ./.
# (7 characters long SHA Code)
- name: Extract short SHA
id: extract_sha
shell: bash
run: |
full_sha="${{ github.sha }}"
short_sha="${full_sha:0:7}"
echo "short_sha=$short_sha" >> "$GITHUB_OUTPUT"
- name: Extract commit description
id: extract_desc
shell: bash
run: |
# Use github.event.head_commit.message to get the full commit message.
# tail -n +3 attempts to remove the first two lines (subject line and empty line),
# assuming a conventional commit message structure. Adjust if your messages vary.
desc=$(echo "${{ github.event.head_commit.message }}" | tail -n +3)
echo "commit_description<<EOF" >> "$GITHUB_OUTPUT"
echo "$desc" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Create Draft GitHub Release with Both Assets
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.extract_sha.outputs.short_sha }}
name: v${{ steps.extract_sha.outputs.short_sha }}
draft: true
prerelease: true
body: |
v${{ steps.extract_sha.outputs.short_sha }}
**Triggered by committer:** @${{ github.actor }}
---
# What's changed?
${{ steps.extract_desc.outputs.commit_description }}
files: |
./tread-bin-UNIX.zip
./tread-bin-WIN.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Required for release creation