Skip to content

Commit

Permalink
Adds create-package support for platform
Browse files Browse the repository at this point in the history
- Pack experimental feature: buildpacks/pack#926

Signed-off-by: Micah Young <[email protected]>
  • Loading branch information
Micah Young committed Nov 11, 2020
1 parent 84c4248 commit 91efb5c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ package:
include_dependencies: false
register: true
registry_token: ${{ secrets.JAVA_REGISTRY_TOKEN }}
platform: { os: "windows" }
```

* [Example `create-package.yml`](https://github.com/paketo-buildpacks/adopt-openjdk/blob/main/.github/workflows/create-package.yml)
Expand Down
4 changes: 4 additions & 0 deletions octo/create-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ fi

[[ -e package.toml ]] && cp package.toml "${HOME}"/package.toml
printf '[buildpack]\nuri = "%s"' "${HOME}"/buildpack >> "${HOME}"/package.toml

if [ -n "${PLATFORM_OS}" ]; then
printf '[platform]\nos = "%s"' "${PLATFORM_OS}" >> "${HOME}"/package.toml
fi
1 change: 1 addition & 0 deletions octo/create_package.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func ContributeCreatePackage(descriptor Descriptor) (*Contribution, error) {
Env: map[string]string{
"INCLUDE_DEPENDENCIES": strconv.FormatBool(descriptor.Package.IncludeDependencies),
"VERSION": "${{ steps.version.outputs.version }}",
"PLATFORM_OS": descriptor.Package.Platform.OS,
},
},
{
Expand Down
5 changes: 5 additions & 0 deletions octo/descriptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ type Package struct {
IncludeDependencies bool `yaml:"include_dependencies"`
Register bool
RegistryToken string `yaml:"registry_token"`
Platform *Platform
}

type Platform struct {
OS string
}

type Test struct {
Expand Down

0 comments on commit 91efb5c

Please sign in to comment.