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 build workflow parameter build_profiles for changing the build profiles #33

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions .github/workflows/build_pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ on:
build_container:
type: string
default: ghcr.io/gardenlinux/package-build
build_options:
type: string
default: ""
build_profiles:
type: string
default: ""
source:
type: string
default: ""
Expand Down Expand Up @@ -40,6 +46,7 @@ jobs:
source_name: ${{ steps.build.outputs.source_name }}
source_version: ${{ steps.build.outputs.source_version }}
build_options: ${{ steps.build.outputs.build_options }}
build_profiles: ${{ steps.build.outputs.build_profiles }}
release: ${{ steps.release.outputs.release }}
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -86,6 +93,7 @@ jobs:
)"
echo "pkg=$pkg" | tee -a "$GITHUB_OUTPUT"
echo "build_options=$(cat output/.build_options)" | tee -a "$GITHUB_OUTPUT"
echo "build_profiles=$(cat output/.build_profiles)" | tee -a "$GITHUB_OUTPUT"
echo "source_name=$(cat output/.source_name)" | tee -a "$GITHUB_OUTPUT"
echo "source_version=$(cat output/.source_version)" | tee -a "$GITHUB_OUTPUT"
- name: upload source packages
Expand Down Expand Up @@ -125,6 +133,7 @@ jobs:
run: |
cd input/
echo "${{ needs.source.outputs.build_options }}" > .build_options
echo "${{ needs.source.outputs.build_profiles}}" > .build_profiles
ln -s "${{ needs.source.outputs.pkg }}.dsc" .source
- name: fetch dependencies
run: |
Expand Down
2 changes: 2 additions & 0 deletions container/bin/build_archdep
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ exec 1>&2
main() (
input_dir="${1:-/input}"
DEB_BUILD_OPTIONS="$(cat "$input_dir/.build_options")"
DEB_BUILD_PROFILES="$(cat "$input_dir/.build_profiles")"
export DEB_BUILD_OPTIONS
export DEB_BUILD_PROFILES

dsc="$(realpath "$input_dir/.source")"
dpkg_arch="$(dpkg --print-architecture)"
Expand Down
2 changes: 2 additions & 0 deletions container/bin/build_indep
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ exec 1>&2
main() (
input_dir="${1:-/input}"
DEB_BUILD_OPTIONS="$(cat "$input_dir/.build_options")"
DEB_BUILD_PROFILES="$(cat "$input_dir/.build_profiles")"
export DEB_BUILD_OPTIONS
export DEB_BUILD_PROFILES

dsc="$(realpath "$input_dir/.source")"
dsc_arch="$(grep -oP '(?<=^Architecture: ).*' < "$dsc" | tr ' ' '\n')"
Expand Down
5 changes: 4 additions & 1 deletion container/bin/build_source
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ main() (
source="$(yq -r '.jobs.build_pkg.with.source // "'$name'"' < "$inputs_file")"
debian_source="$(yq -r '.jobs.build_pkg.with.debian_source // "'$debian_source'"' < "$inputs_file")"
build_options="terse $(yq -r '.jobs.build_pkg.with.build_options // ""' < "$inputs_file")"
build_profiles="$(yq -r '.jobs.build_pkg.with.build_profiles // ""' < "$inputs_file")"

# Define Build Options
export DEB_BUILD_OPTIONS="$build_options"
export DEB_BUILD_PROFILES="$build_profiles"

# Set permissions
git -C /input config --global --add safe.directory '*'
Expand Down Expand Up @@ -64,13 +66,14 @@ main() (

# Add some meta files next to the created artifacts
echo "$DEB_BUILD_OPTIONS" > .build_options
echo "$DEB_BUILD_PROFILES" > .build_profiles
echo "${pkg}" > .source_name
echo "${version}" > .source_version
ln -s "${pkg}_${version}.dsc" .source

# Copy all artifacts to the dedicated output directory
if [ -d "/output" ]; then
{ echo .build_options; echo .source_name; echo .source_version; echo .source; echo "${pkg}_${version}.dsc"; get_files < "${pkg}_${version}.dsc"; } | while read file; do
{ echo .build_options; echo .build_profiles; echo .source_name; echo .source_version; echo .source; echo "${pkg}_${version}.dsc"; get_files < "${pkg}_${version}.dsc"; } | while read file; do
sudo cp -d "$file" "/output/$file"
done
fi
Expand Down