Skip to content

Commit a2f866e

Browse files
authored
Merge pull request #8 from kubewarden/artifacthub
feat: Consume check artifacthub-pkg.yml
2 parents 5ecff1b + 515341c commit a2f866e

4 files changed

Lines changed: 15 additions & 5 deletions

File tree

.github/workflows/test.yml.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ jobs:
44
test:
55
name: run tests and linters
66
uses: kubewarden/github-actions/.github/workflows/reusable-test-policy-swift.yml@v1
7+
with:
8+
artifacthub: false # change to true to check artifacthub-pkg.yml

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
CONTAINER_RUNTIME ?= docker
22
CONTAINER_IMAGE := "ghcr.io/kubewarden/swift-wasm-runner:5.3-p1"
3+
VERSION := $(shell git describe --exact-match --tags $(git log -n1 --pretty='%h') | cut -c2-)
34

45
build:
56
ifndef CONTAINER_RUNTIME
@@ -41,8 +42,15 @@ endif
4142
@printf "Optimize Wasm binary, hold on...\n"
4243
wasm-opt -Os .build/wasm32-unknown-wasi/release/Policy.wasm -o policy.wasm
4344

45+
artifacthub-pkg.yml: metadata.yml
46+
kwctl scaffold artifacthub \
47+
--metadata-path metadata.yml --version $(VERSION) \
48+
--questions-path questions-ui.yml > artifacthub-pkg.yml.tmp \
49+
&& mv artifacthub-pkg.yml.tmp artifacthub-pkg.yml \
50+
|| rm -f artifacthub-pkg.yml.tmp
51+
4452
annotate:
45-
kwctl annotate -m metadata.yml -o annotated-policy.wasm policy.wasm
53+
kwctl annotate -m metadata.yml -u README.md -o annotated-policy.wasm policy.wasm
4654

4755
e2e-tests:
4856
bats e2e.bats

artifacthub-pkg.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
---
2+
###
3+
### Use `make artifacthub-pkg.yml` to auto-generate this file
4+
### See docs.kubewarden.io for publishing to ArtifactHub
5+
###
26
version: 0.0.1
37
name: policy-name
48
displayName: Policy Name

metadata.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,3 @@ annotations:
1313
io.kubewarden.policy.url: https://github.com/yourorg/policy-name
1414
io.kubewarden.policy.source: https://github.com/yourorg/policy-name
1515
io.kubewarden.policy.license: Apache-2.0
16-
io.kubewarden.policy.usage: |
17-
Long explaination.
18-
19-
**Note well:** this can be Markdown text

0 commit comments

Comments
 (0)