Skip to content

Commit

Permalink
chore: add examples for validate and bundle (#1)
Browse files Browse the repository at this point in the history
* chore: add examples for validate and bundle

* chore: fix build
  • Loading branch information
markphelps authored Jan 3, 2024
1 parent 115cb6a commit 527cf15
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 7 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ jobs:
- name: Test Install (Latest)
uses: ./

- name: Test Install Version (v1.32.0)
- name: Test Install and Validate (Latest)
uses: ./
with:
version: v1.32.0
args: validate

- name: Test Install Version (v1.33.0)
uses: ./
with:
version: v1.33.0

- name: Validate After Install
run: flipt validate
44 changes: 42 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,44 @@

This action installs [Flipt](https://flipt.io) in your GitHub Actions workflow. You can pass additional arguments to the `flipt` command using the `args` input. If no arguments are provided, `flipt` will be installed and run with the `--help` flag.

Any of the [Flipt CLI commands](https://www.flipt.io/docs/cli/overview) can be run using this action.

## Example

## Usage
### Validate

Docs: <https://www.flipt.io/docs/cli/commands/validate>

This example installs Flipt and runs `flipt validate` against the repository root.

```yaml
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: flipt-io/setup-action@v0.0.1
# with:
# Optional, additional arguments to pass to the `flipt` command
# args:
# Optional, the version of Flipt to install, defaults to the latest release
# version:
# Optional, the directory to run Flipt against, defaults to the repository root
# working-directory:

- run: flipt validate
```
### OCI Bundle and Push
Docs: <https://www.flipt.io/docs/cli/commands/bundle/build>
This example installs Flipt and runs `flipt bundle build` against the repository root. It then pushes the bundle to a registry with `flipt bundle push`, allowing you to store and share your feature flag data as an OCI artifact.

```yaml
validate:
runs-on: ubuntu-latest
steps:
# Checkout the target repository
- uses: actions/checkout@v3
- uses: flipt-io/setup-action@v0.0.1
Expand All @@ -23,6 +52,17 @@ validate:
# version:
# Optional, the directory to run Flipt against, defaults to the repository root
# working-directory:

- name: Get UUID
id: uuid
run: |
echo "uuid=$(uuidgen)" >> $GITHUB_OUTPUT
# Build the bundle and push it to an ephemeral registry (available for 1 hour)
- name: Build and Push bundle
run: |
flipt bundle build {{ steps.uuid.outputs.uuid }}:latest ttl.sh/${{ steps.uuid.outputs.uuid }}:1h
flipt bundle push ttl.sh/${{ steps.uuid.outputs.uuid }}:1h
```
## Customizing
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions examples/features.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
namespace: default
flags:
- key: flipt
name: flipt
description: flipt
enabled: false
variants:
- key: fromFlipt
name: flipt
- key: fromFlipt2
name: flipt
rules:
- segment: internal-users
rank: 1
distributions:
- variant: fromFlipt
rollout: 100
- segment: all-users
rank: 2
distributions:
- variant: fromFlipt2
rollout: 100
segments:
- key: all-users
name: All Users
description: All Users
match_type: ALL_MATCH_TYPE
- key: internal-users
name: Internal Users
description: All internal users at flipt.
constraints:
- type: STRING_COMPARISON_TYPE
property: organization
operator: eq
value: flipt
match_type: ALL_MATCH_TYPE
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ async function flipt(args: string[] = []): Promise<void> {

core.startGroup(`Installing flipt:${version}`)
await downloadFlipt(version)
core.info('flipt installed successfully')
core.endGroup()

core.info('flipt installed successfully')

if (!args || args.length === 0) {
core.info('flipt command not provided, skipping')
return
Expand Down

0 comments on commit 527cf15

Please sign in to comment.