Build Deb Workflow #41
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 Deb Workflow | |
on: | |
workflow_run: | |
workflows: [Build Workflow] | |
types: [completed] | |
inputs: | |
build_type: | |
description: 'Build Configuration to use (Debug, Release, RelWithDebInfo or MinSizeRel).' | |
required: false | |
default: 'Release' | |
jobs: | |
Linux-64: | |
name: Linux x64 | |
runs-on: ubuntu-latest | |
container: ubuntu:22.04 | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: Set build configuration | |
id: build_configuration | |
run: | | |
BUILD_TYPE=${{github.event.inputs.build_type}} | |
echo "build_type=${BUILD_TYPE:-"Debug"}" >> $GITHUB_OUTPUT | |
- name: Setup Dependencies | |
run: | | |
apt update -y && apt install -y sudo | |
sudo apt-get update -y | |
sudo apt-get install -y ca-certificates gpg wget | |
test -f /usr/share/doc/kitware-archive-keyring/copyright || | |
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null | |
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null | |
sudo apt-get update -y | |
test -f /usr/share/doc/kitware-archive-keyring/copyright || | |
sudo rm /usr/share/keyrings/kitware-archive-keyring.gpg | |
sudo apt-get install kitware-archive-keyring | |
sudo apt install -y file build-essential cmake ninja-build wget gettext p7zip-full libsdl2-dev | |
- name: Download source package | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
run_id: context.payload.workflow_run.id, | |
}); | |
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { | |
return artifact.name == "Linux-x64" | |
})[0]; | |
let download = await github.rest.actions.downloadArtifact({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
artifact_id: matchArtifact.id, | |
archive_format: 'zip', | |
}); | |
let fs = require('fs'); | |
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/Linux-x64.zip`, Buffer.from(download.data)); | |
- name: Package Debian | |
run: | | |
sudo apt install -y debmake debhelper dh-make | |
7z x Linux-x64.zip -aoa -bd -y | |
mkdir -p Debian/Linux-x64 | |
mkdir -p ${{steps.build_configuration.outputs.build_type}}/Artifacts/Linux-x64 | |
tar zxf Linux-x64/max-port-*-Source.tar.gz --directory=Debian/Linux-x64 | |
cd Debian/Linux-x64/max-port-*-Source | |
sh cmake/scripts/linux/get-dependencies cmake/versions.cmake | |
debmake --tar --monoarch --invoke debuild | |
cp ../max-port_*_amd64.deb ../../../${{steps.build_configuration.outputs.build_type}}/Artifacts/Linux-x64/ | |
cp ../max-port-dbgsym_*_amd64.ddeb ../../../${{steps.build_configuration.outputs.build_type}}/Artifacts/Linux-x64/ | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{github.job}} | |
path: ${{steps.build_configuration.outputs.build_type}}/Artifacts |