Skip to content

Commit eeaaad9

Browse files
committed
fix(ci): add GitHub Action
1 parent e5072ad commit eeaaad9

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

README.md

+34
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,40 @@ The following features are currently not supported, but are planned for future r
3939
- **Diffing**
4040
Using the `git` history of the cluster configuration to display potential actions that can be taken to bring the cluster up to date with the configuration.
4141

42+
## GitHub Actions 🤖
43+
44+
You can use GitHub Actions to run `k3se` inside your CI pipeline. Simply add the following workflow:
45+
46+
```yaml
47+
name: Deploy
48+
49+
on:
50+
- push
51+
52+
jobs:
53+
kubernetes:
54+
name: Kubernetes
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Check out repository
58+
uses: actions/checkout@v3
59+
60+
- name: Deploy k3s cluster
61+
uses: nicklasfrahm/k3se@v0
62+
with:
63+
config: "examples/standalone.yml"
64+
```
65+
66+
### Input variables
67+
68+
See [action.yml](./action.yml) for more detailed information. **Please note that all input variables must have string values. It is thus recommend to always use quotes.**
69+
70+
| Input variable | Default value | Description |
71+
| -------------- | ------------- | ------------------------------------------------------------------------------------------- |
72+
| `command` | `up` | Subcommand to be executed. |
73+
| `config` | `k3se.yml` | Path to the cluster configuration. May be set to `""` if the command does not use a config. |
74+
| `version` | `latest` | Version of `k3se` to use. |
75+
4276
## License 📄
4377

4478
This project is and will always be licensed under the terms of the [MIT license][file-license].

action.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "k3se for GitHub Actions"
2+
description: "A lightweight Kubernetes engine that deploys k3s clusters declaratively based on a cluster configuration file."
3+
branding:
4+
color: gray-dark
5+
icon: server
6+
inputs:
7+
command:
8+
description: "Command to execute"
9+
required: true
10+
default: "up"
11+
config:
12+
description: "Path to the cluster configuration file"
13+
required: false
14+
default: "k3se.yml"
15+
version:
16+
description: "Version of k3s to use"
17+
required: true
18+
default: "latest"
19+
20+
runs:
21+
using: "composite"
22+
steps:
23+
- run: |
24+
docker run -t -v ${GITHUB_WORKSPACE}:/workspace -w /workspace ghcr.io/nicklasfrahm/k3se:${{ inputs.version }} ${{ inputs.command }} ${{ inputs.config }}
25+
shell: bash

0 commit comments

Comments
 (0)