Skip to content

Commit

Permalink
Add possibility to also download latest version of a dependency (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
nanory authored Dec 12, 2023
1 parent 42c3f59 commit af919cb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
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:** `[email protected]`| 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

0 comments on commit af919cb

Please sign in to comment.