Skip to content

Commit

Permalink
Merge pull request #225 from s3rj1k/prebuild_script
Browse files Browse the repository at this point in the history
Add PREBUILD_SCRIPT support.
  • Loading branch information
andywolk authored Feb 22, 2024
2 parents 5078383 + cf10e40 commit e7825be
Showing 1 changed file with 24 additions and 2 deletions.
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

0 comments on commit e7825be

Please sign in to comment.