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 possibility to also download latest version of a dependency #65

Merged
merged 2 commits into from
Dec 12, 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
18 changes: 9 additions & 9 deletions .github/workflows/build_pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ on:
build_profiles:
type: string
default: ""
build_dependencies:
type: string
default: ""
source:
type: string
default: ""
debian_source:
type: string
default: ""
dependencies:
type: string
default: ""
email:
type: string
default: ""
Expand Down Expand Up @@ -70,11 +70,11 @@ jobs:
- name: fetch dependencies
run: |
mkdir _pkgs
while IFS=@ read -r repo tag; do
./scripts/gh_release "${{ github.token }}" "$repo" list "$tag" | grep '\.deb$' | while read -r url; do
while IFS=@ read -r repo reference; do
./scripts/gh_release "${{ github.token }}" "$repo" list "$reference" | grep '\.deb$' | while read -r url; do
(cd _pkgs && wget "$url")
done
done <<< '${{ inputs.dependencies }}'
done <<< '${{ inputs.build_dependencies }}'
ls -lah _pkgs
(cd _pkgs && dpkg-scanpackages --multiversion . > Packages)
cat _pkgs/Packages
Expand Down Expand Up @@ -143,11 +143,11 @@ jobs:
- name: fetch dependencies
run: |
mkdir _pkgs
while IFS=@ read -r repo tag; do
./scripts/gh_release "${{ github.token }}" "$repo" list "$tag" | grep '\.deb$' | while read -r url; do
while IFS=@ read -r repo reference; do
./scripts/gh_release "${{ github.token }}" "$repo" list "$reference" | grep '\.deb$' | while read -r url; do
(cd _pkgs && wget "$url")
done
done <<< '${{ inputs.dependencies }}'
done <<< '${{ inputs.build_dependencies }}'
ls -lah _pkgs
(cd _pkgs && dpkg-scanpackages --multiversion . > Packages)
cat _pkgs/Packages
Expand Down
2 changes: 1 addition & 1 deletion docs/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ Input Parameters available in `build_pkg.yml`:
| --------- | ---- | ------------|
|`ref`|**Type:** string<br>**Default:** `${{ github.sha }}`| The ref (commit or branch) that should be checked out from the `package-build` repo while processing the package build.|
|`build_container`|**Type:** string<br>**Default:** `ghcr.io/gardenlinux/package-build`| The container image used for building the package.|
|`dependencies`|**Type:** string| Comma-separated list of repositories and tags to fetch dependencies from.|
|`source`|**Type:** string| The source name of the package. There are three values that one can choose from:<br>- Debian Source Package: `{SOURCE PACKAGE NAME}`<br>- Git Source: `git+{GIT URL}`<br>- Native Build: `native`|
|`debian_source`|**Type:** string| Defines from which source the `debian/` directory should be used. There are three values that one can choose from:<br>- Debian Source Package: `{SOURCE PACKAGE NAME}`<br>- Git Source: `git+{GIT URL}`<br>- Native Build: `native`|
|`email`|**Type:** string<br>**Default:** `contact@gardenlinux.io`| The Debian package maintainer email.|
Expand All @@ -60,6 +59,7 @@ Input Parameters available in `build_pkg.yml`:
|`message`|**Type:** string<br>**Default:** `Rebuild for Garden Linux.`| The changelog entry message for the package build.|
|`build_option`|**Type:** string| Additional build options for the package build. Build option `terse` is always set.|
|`build_profiles`|**Type:** string| Additional build profiles for the package build.|
|`build_dependencies`|**Type:** string| List of build dependencies that should be included in the build. Each new line is a new dependency.<br><br>The format looks like this:<br>`{REPO}@{"latest" \| GIT TAG}` <br>`gardenlinux/package-libyang2@latest`<br>`gardenlinux/package-libyang2@gardenlinux/2.1.128-0gardenlinux0`|
|`git_filter`|**Type:** string<br>**Default:** `.*`<br>**Scope:** `source: git`| This parameter let's you filter Git tags that should be skipped for the upstream version determination. |
|`git_tag_match`|**Type:** string<br>**Default:** `(.*)`<br>**Scope:** `source: git`| This parameter defines what part of a given Git Tag is considered to be the upstream version. The first regex match group is always the designated upstream version. |

Expand Down
9 changes: 7 additions & 2 deletions scripts/gh_release
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ case "$action" in

;;
"list")
tag="$1"; shift
get "releases/tags/$tag" | jq -r '.assets[] | .browser_download_url'
reference="$1"; shift
if [[ "$reference" == "latest" ]]; then
api_url="releases/latest"
else
api_url="releases/tags/$reference"
fi
get "$api_url" | jq -r '.assets[] | .browser_download_url'

;;
"create")
Expand Down