Skip to content
This repository was archived by the owner on Jan 9, 2025. It is now read-only.

Commit eb43756

Browse files
committed
added action.yaml
1 parent f8746c9 commit eb43756

File tree

3 files changed

+102
-1
lines changed

3 files changed

+102
-1
lines changed

Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM ghcr.io/appcd-dev/appcd-dist/stackgen-cli:latest
2+
3+
ENTRYPOINT ["/usr/bin/stackgen"]

README.md

+66-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,66 @@
1-
# stackgen-action
1+
# Stackgen CLI GitHub Action
2+
3+
This action allows you to run Stackgen CLI commands in your GitHub workflows.
4+
5+
## Inputs
6+
7+
### Required Inputs
8+
9+
- `command`: The main stackgen command to run (appstack, provision, destroy, etc)
10+
11+
### Optional Inputs
12+
13+
- `subcommand`: Subcommand for the main command (if applicable)
14+
- `flags`: Command flags as a multi-line string, one flag per line
15+
- `aws_access_key`: AWS Access Key for authentication
16+
- `aws_secret_key`: AWS Secret Key for authentication
17+
- `aws_region`: AWS Region
18+
19+
## Example Usage
20+
21+
```yaml
22+
- uses: your-org/stackgen-action@v1
23+
with:
24+
command: 'provision'
25+
flags: |
26+
--appstack-id my-stack-id
27+
--apply
28+
--work-dir ./infrastructure
29+
--log 3
30+
--output human
31+
--var environment=production
32+
--var region=us-west-2
33+
--backend-config bucket=my-terraform-state
34+
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
35+
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
36+
aws_region: 'us-west-2'
37+
```
38+
39+
## Advanced Usage - Multiple Commands
40+
41+
```yaml
42+
jobs:
43+
deploy:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v2
47+
48+
- name: Generate Infrastructure
49+
uses: your-org/stackgen-action@v1
50+
with:
51+
command: 'generate'
52+
flags: |
53+
--work-dir ./infrastructure
54+
55+
- name: Provision Infrastructure
56+
uses: your-org/stackgen-action@v1
57+
with:
58+
command: 'provision'
59+
flags: |
60+
--apply
61+
--work-dir ./infrastructure
62+
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
63+
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
64+
```
65+
66+
Each flag in the `flags` input should be on a new line, including its value if applicable. This provides a more straightforward and readable way to pass command-line arguments to the Stackgen CLI.

action.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: 'Stackgen CLI Action'
2+
description: 'GitHub Action for Stackgen CLI operations'
3+
inputs:
4+
command:
5+
description: 'The stackgen command to run (appstack, provision, destroy, etc)'
6+
required: true
7+
subcommand:
8+
description: 'Subcommand for the main command (if applicable)'
9+
required: false
10+
flags:
11+
description: 'Command flags as a multi-line string, one flag per line'
12+
required: false
13+
aws_access_key:
14+
description: 'AWS Access Key'
15+
required: false
16+
aws_secret_key:
17+
description: 'AWS Secret Key'
18+
required: false
19+
aws_region:
20+
description: 'AWS Region'
21+
required: false
22+
23+
runs:
24+
using: 'docker'
25+
image: 'Dockerfile'
26+
args:
27+
- ${{ inputs.command }}
28+
- ${{ inputs.subcommand }}
29+
- ${{ inputs.flags }}
30+
env:
31+
AWS_ACCESS_KEY_ID: ${{ inputs.aws_access_key }}
32+
AWS_SECRET_ACCESS_KEY: ${{ inputs.aws_secret_key }}
33+
AWS_DEFAULT_REGION: ${{ inputs.aws_region }}

0 commit comments

Comments
 (0)