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
name: Build AgentExec Distributions | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
pull_request: | |
permissions: | |
contents: read | |
jobs: | |
source-archive: | |
name: Create Source Archive | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install and Setup Task | |
run: | | |
chmod +x ./bootstrap.sh | |
./bootstrap.sh | |
source ~/.bashrc | |
echo "${HOME}/.local/bin" >> $GITHUB_PATH | |
- name: Set Version Information | |
id: version | |
run: | | |
VERSION=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0.1") | |
echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
- name: Create Source Archive | |
run: task build:cross | |
- name: Upload Source Archive | |
uses: actions/upload-artifact@v4 | |
with: | |
name: source-archive | |
path: build/* | |
if-no-files-found: error | |
build-binaries: | |
name: Build Binaries | |
needs: source-archive | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# Linux builds | |
- os: ubuntu-latest | |
goos: linux | |
architecture: amd64 | |
- os: ubuntu-latest | |
goos: linux | |
architecture: arm64 | |
- os: ubuntu-latest | |
goos: linux | |
architecture: 386 | |
- os: ubuntu-latest | |
goos: linux | |
architecture: arm | |
arm: 6 | |
# macOS builds | |
- os: macos-latest | |
goos: darwin | |
architecture: amd64 | |
- os: macos-latest | |
goos: darwin | |
architecture: arm64 | |
# Windows builds | |
- os: windows-latest | |
goos: windows | |
architecture: amd64 | |
- os: windows-latest | |
goos: windows | |
architecture: arm64 | |
- os: windows-latest | |
goos: windows | |
architecture: 386 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23.3' | |
check-latest: true | |
- name: Install and Setup Task | |
shell: bash | |
run: | | |
chmod +x ./bootstrap.sh | |
./bootstrap.sh | |
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then | |
source ~/.zshrc | |
else | |
source ~/.bashrc | |
fi | |
echo "${HOME}/.local/bin" >> $GITHUB_PATH | |
- name: Setup Development Environment | |
run: task setup | |
- name: Build Binary | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.architecture }} | |
GOARM: ${{ matrix.arm }} | |
run: task build:cross | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binary-${{ matrix.goos }}-${{ matrix.architecture }} | |
path: build/* | |
if-no-files-found: error | |
create-installers: | |
name: Create Installers | |
needs: [source-archive, build-binaries] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: macos-latest | |
goos: darwin | |
architecture: amd64 | |
- os: macos-latest | |
goos: darwin | |
architecture: arm64 | |
- os: windows-latest | |
goos: windows | |
architecture: amd64 | |
- os: windows-latest | |
goos: windows | |
architecture: arm64 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install and Setup Task | |
shell: bash | |
run: | | |
chmod +x ./bootstrap.sh | |
./bootstrap.sh | |
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then | |
source ~/.zshrc | |
else | |
source ~/.bashrc | |
fi | |
echo "${HOME}/.local/bin" >> $GITHUB_PATH | |
- name: Download Binary | |
uses: actions/download-artifact@v4 | |
with: | |
name: binary-${{ matrix.goos }}-${{ matrix.architecture }} | |
path: build/ | |
- name: Setup Windows Environment | |
if: matrix.os == 'windows-latest' | |
shell: bash | |
run: | | |
choco install wix --version=3.11.2 -y | |
echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" >> $GITHUB_PATH | |
- name: Create Installer | |
shell: bash | |
run: | | |
VERSION=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0.1") | |
mkdir -p packages | |
if [[ "${{ matrix.goos }}" == "darwin" ]]; then | |
pkgbuild --identifier com.agentexec.cli \ | |
--install-location /usr/local/bin \ | |
--root build \ | |
--scripts scripts/macos \ | |
"packages/agentexec${VERSION}.${GOOS}-${GOARCH}.pkg" | |
elif [[ "${{ matrix.goos }}" == "windows" ]]; then | |
export INSTALLER_GUID=$(uuidgen) | |
export COMPONENT_GUID=$(uuidgen) | |
candle.exe -arch x64 \ | |
-o installer.wixobj \ | |
.github/workflows/installer.wix | |
light.exe -o "packages/agentexec${VERSION}.${GOOS}-${GOARCH}.msi" installer.wixobj | |
fi | |
cd packages | |
if [[ "${{ matrix.goos }}" == "darwin" ]]; then | |
sha256sum "agentexec${VERSION}.${GOOS}-${GOARCH}.pkg" >> ../build/SHASUMS256.txt | |
else | |
sha256sum "agentexec${VERSION}.${GOOS}-${GOARCH}.msi" >> ../build/SHASUMS256.txt | |
fi | |
- name: Upload Installer | |
uses: actions/upload-artifact@v4 | |
with: | |
name: installer-${{ matrix.goos }}-${{ matrix.architecture }} | |
path: | | |
packages/* | |
build/SHASUMS256.txt | |
if-no-files-found: error | |
validate-checksums: | |
name: Validate Checksums | |
needs: [create-installers] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Install and Setup Task | |
run: | | |
chmod +x ./bootstrap.sh | |
./bootstrap.sh | |
source ~/.bashrc | |
echo "${HOME}/.local/bin" >> $GITHUB_PATH | |
- name: Download All Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: build | |
merge-multiple: true | |
- name: Validate Checksums | |
run: task build:verify |