ci: multi-OS agent binary build
This commit is contained in:
41
.gitea/workflows/build-binaries.yml
Normal file
41
.gitea/workflows/build-binaries.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
name: Build Agent Binaries
|
||||
on:
|
||||
push:
|
||||
paths: ['agents/agent.py', '.gitea/workflows/build-binaries.yml']
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install PyInstaller (unix)
|
||||
if: matrix.os != 'windows-latest'
|
||||
run: pip install pyinstaller
|
||||
- name: Install PyInstaller (windows)
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: pip install pyinstaller
|
||||
- name: Bake token + build (unix)
|
||||
if: matrix.os != 'windows-latest'
|
||||
shell: bash
|
||||
env:
|
||||
AGENT_TOKEN: ${{ secrets.NEXUS_AGENT_TOKEN }}
|
||||
run: |
|
||||
sed "s/__AGENT_TOKEN__/$AGENT_TOKEN/" agents/agent.py > baked.py
|
||||
pyinstaller --onefile --name NexusAgent-${{ matrix.os }} baked.py
|
||||
- name: Bake token + build (windows)
|
||||
if: matrix.os == 'windows-latest'
|
||||
shell: pwsh
|
||||
env:
|
||||
AGENT_TOKEN: ${{ secrets.NEXUS_AGENT_TOKEN }}
|
||||
run: |
|
||||
(Get-Content agents/agent.py) -replace '__AGENT_TOKEN__', $env:AGENT_TOKEN | Set-Content baked.py
|
||||
pyinstaller --onefile --name NexusAgent-windows baked.py
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: NexusAgent-${{ matrix.os }}
|
||||
path: dist/NexusAgent*
|
||||
Reference in New Issue
Block a user