Skip to content
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
vendor
jsonnetfile.lock.json
vendor
35 changes: 32 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
generate:
jsonnet -m gen -S -J vendor main.libsonnet | xargs -n 1 -- jsonnetfmt --no-use-implicit-plus -i

JSONNET_BIN ?= jsonnet

jsonnetfile.json:
jb init

vendor jsonnetfile.lock.json: jsonnetfile.json
jb install

.PHONY: test
test: vendor jsonnetfile.lock.json
@cd test/ && make test

.PHONY: fmt
fmt:
@find . \
-path './.git' -prune \
-o -name 'vendor' -prune \
-o -name '*.libsonnet' -print \
-o -name '*.jsonnet' -print \
| xargs -n 1 -- jsonnetfmt --no-use-implicit-plus -i

.PHONY: docs
docs: jsonnetfile.json
@rm -rf docs/
@$(JSONNET_BIN) \
-J generator/vendor \
-S -c -m docs \
-e '(import "github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet").render(import "main.libsonnet")'

.PHONY: generate
generate: jsonnetfile.json
jsonnet -J generator/vendor -S generator/generate.jsonnet | jsonnetfmt - > raw.libsonnet
35 changes: 32 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
# github-actions-libsonnet

Jsonnet library for github-actions-libsonnet
Jsonnet library to create GitHub actions workflows.
## Install

> [!CAUTION]
> Incomplete library, very experimental
```
jb install github.com/crdsonnet/github-actions-libsonnet@main
```

## Usage

```jsonnet
local ga = import 'github.com/crdsonnet/github-actions-libsonnet/main.libsonnet';

local exampleWorkflow =
ga.workflow.withName('example workflow')
+ ga.workflow.on.pull_request.withBranches(['main'])
+ ga.workflow.withJobs({
example:
ga.job.withRunsOn('ubuntu-latest')
+ ga.job.withSteps(
ga.job.step.withName('Checkout')
+ ga.job.step.withUses('actions/checkout@v4')
),
});

std.manifestYamlDoc(exampleWorkflow, indent_array_in_object=true, quote_keys=false)

```


## Subpackages

* [job](job/index.md)
* [workflow](workflow.md)
Loading