Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PREBUILD_SCRIPT support. #225

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions .github/workflows/ci-deb-packages-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ on:
type: string
default: 'echo "No custom bootstrap script was provided"'
description: Custom `sh` bootstrap script
PREBUILD_SCRIPT:
required: false
type: string
default: 'echo "No custom prebuild script was provided"'
description: Custom `sh` prebuild script
INSTALL_DEPENDENCIES:
required: false
type: boolean
Expand Down Expand Up @@ -71,6 +76,9 @@ on:
# outputs:
# ARTIFACT_NAME:
# value: deb-${{env.IMAGE_TAG}}-${{env.PLATFORM}}-artifact
secrets:
GENERIC_TOKEN:
required: false

jobs:
build:
Expand Down Expand Up @@ -129,6 +137,8 @@ jobs:
# eval inside runner
hash=$(echo $GITHUB_SHA | cut -c1-10)

eval "${{ inputs.PREBUILD_SCRIPT }}"

if [ "${INSTALL_DEPENDENCIES}" = "true" ]; then
apt-get -q update && \
mk-build-deps --install --remove debian/control --tool "apt-get -y --no-install-recommends" && \
Expand Down Expand Up @@ -172,6 +182,8 @@ jobs:
# eval inside runner
hash=$(echo $GITHUB_SHA | cut -c1-10)

eval "${{ inputs.PREBUILD_SCRIPT }}"

PACKAGE_RELEASE="$GITHUB_RUN_ID.\${hash}" cmake . -DCMAKE_BUILD_TYPE=${{ inputs.CMAKE_BUILD_TYPE }} -DCMAKE_INSTALL_PREFIX=${{ inputs.CMAKE_INSTALL_PREFIX }} && make package

EOF
Expand All @@ -181,10 +193,20 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: build debs
- name: Build debs in Docker
shell: sh
env:
GENERIC_TOKEN: ${{ secrets.GENERIC_TOKEN }}
run: |
docker run --platform linux/${{ inputs.PLATFORM }} --rm --entrypoint="/usr/local/bin/run.sh" -w /root -v $(pwd):/root -v /tmp/${GITHUB_RUN_ID}/run.sh:/usr/local/bin/run.sh ${{ inputs.BASE_IMAGE }}:${{ inputs.DISTRO_CODENAME }}
docker run \
--platform linux/${{ inputs.PLATFORM }} \
--rm \
--entrypoint="/usr/local/bin/run.sh" \
-w /root \
-v $(pwd):/root \
-v /tmp/${GITHUB_RUN_ID}/run.sh:/usr/local/bin/run.sh:ro \
-e GENERIC_TOKEN="${GENERIC_TOKEN}" \
${{ inputs.BASE_IMAGE }}:${{ inputs.DISTRO_CODENAME }}

- name: Set custom variables
shell: sh
Expand Down