{"id":49684541,"url":"https://github.com/huberp/yaml2env","last_synced_at":"2026-05-07T09:31:28.914Z","repository":{"id":321555703,"uuid":"1086248011","full_name":"huberp/yaml2env","owner":"huberp","description":"projects content of a yaml file into the shell environment of unix shell or windows powershell.","archived":false,"fork":false,"pushed_at":"2026-03-20T20:10:39.000Z","size":77,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-21T11:14:00.038Z","etag":null,"topics":["cli","environment","golang","phu-tools","shell","yaml"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/huberp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-30T06:40:58.000Z","updated_at":"2026-03-20T20:12:42.000Z","dependencies_parsed_at":"2025-10-30T09:33:11.440Z","dependency_job_id":null,"html_url":"https://github.com/huberp/yaml2env","commit_stats":null,"previous_names":["huberp/yaml2env"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/huberp/yaml2env","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huberp%2Fyaml2env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huberp%2Fyaml2env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huberp%2Fyaml2env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huberp%2Fyaml2env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huberp","download_url":"https://codeload.github.com/huberp/yaml2env/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huberp%2Fyaml2env/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32731205,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"ssl_error","status_checked_at":"2026-05-07T02:14:29.405Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","environment","golang","phu-tools","shell","yaml"],"created_at":"2026-05-07T09:31:26.482Z","updated_at":"2026-05-07T09:31:28.907Z","avatar_url":"https://github.com/huberp.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yaml2env\n\n[![CI](https://github.com/huberp/yaml2env/workflows/CI/badge.svg)](https://github.com/huberp/yaml2env/actions)\n[![Go Report Card](https://goreportcard.com/badge/github.com/huberp/yaml2env)](https://goreportcard.com/report/github.com/huberp/yaml2env)\n[![Go Reference](https://pkg.go.dev/badge/github.com/huberp/yaml2env.svg)](https://pkg.go.dev/github.com/huberp/yaml2env)\n[![Go Version](https://img.shields.io/github/go-mod/go-version/huberp/yaml2env)](https://github.com/huberp/yaml2env/blob/main/go.mod)\n[![License](https://img.shields.io/github/license/huberp/yaml2env)](https://github.com/huberp/yaml2env/blob/main/LICENSE)\n[![Release](https://img.shields.io/github/v/release/huberp/yaml2env)](https://github.com/huberp/yaml2env/releases)\n\nConvert YAML files to shell environment variables.\n\n## Overview\n\n`yaml2env` reads YAML configuration files and outputs shell commands to set environment variables. Supports nested structures, arrays, and multiple shell formats.\n\n## Features\n\n- Convert YAML to environment variables\n- Support for nested YAML structures\n- Array handling\n- Multiple shell formats: bash, sh, PowerShell, cmd\n- CI/CD environment variable setting with `--set` flag (GitHub Actions)\n- GitHub Actions integration via `$GITHUB_ENV`\n- Cross-platform (Linux/Windows, AMD64/ARM64)\n- Prefix support for variable names\n\n## Installation\n\n### From Release\n\nDownload the latest release for your platform from [releases](https://github.com/huberp/yaml2env/releases).\n\n### From Source\n\n```bash\ngo install github.com/huberp/yaml2env@latest\n```\n\n### Build Locally\n\n```bash\ngit clone https://github.com/huberp/yaml2env.git\ncd yaml2env\ngo build\n```\n\n## Usage\n\n### Basic Usage\n\n```bash\n# Output bash export statements\nyaml2env config.yaml\n\n# Source into current shell\neval \"$(yaml2env config.yaml)\"\n```\n\n### Direct Environment Manipulation (--set)\n\n**⚠️ Important: This flag is primarily designed for CI/CD environments like GitHub Actions.**\n\nFor interactive shell usage, use the sourcing/eval approach instead:\n\n```bash\n# For interactive shells (recommended)\neval \"$(yaml2env config.yaml)\"              # Bash/sh\nInvoke-Expression (yaml2env config.yaml --shell powershell | Out-String)  # PowerShell\n\n# For CI/CD environments (GitHub Actions)\nyaml2env config.yaml --set\n```\n\nWhen using `--set`:\n- Variables are set in the current process using `os.Setenv()`\n- **Limitation**: Cannot modify parent shell environment in interactive sessions\n- **GitHub Actions**: Variables are automatically written to `$GITHUB_ENV` for use in subsequent steps\n- This flag is mutually exclusive with `--shell`\n\n**GitHub Actions Example:**\n\n```yaml\nsteps:\n  - name: Set environment from YAML\n    run: yaml2env config.yaml --set\n  \n  - name: Use variables in next step\n    run: |\n      echo \"Database host: $DATABASE_HOST\"\n      echo \"App name: $APP_NAME\"\n```\n\n### Shell Types\n\n```bash\n# Bash/sh (default)\nyaml2env config.yaml --shell bash\n\n# PowerShell\nyaml2env config.yaml --shell powershell\n\n# Windows CMD\nyaml2env config.yaml --shell cmd\n```\n\n### Prefix\n\nAdd a prefix to all environment variable names:\n\n```bash\nyaml2env config.yaml --prefix MYAPP\n```\n\n### Example\n\nGiven `config.yaml`:\n\n```yaml\ndatabase:\n  host: localhost\n  port: 5432\napp:\n  name: myapp\n  debug: true\n```\n\nRunning `yaml2env config.yaml` outputs:\n\n```bash\nexport DATABASE_HOST='localhost'\nexport DATABASE_PORT='5432'\nexport APP_NAME='myapp'\nexport APP_DEBUG='true'\n```\n\n## Flags\n\n- `-s, --shell string`: Shell type (bash, sh, powershell, cmd) [default: bash]\n- `--set`: Set environment variables in CI/CD environments (GitHub Actions). For interactive shells, use eval/sourcing instead\n- `-p, --prefix string`: Prefix for environment variable names\n- `-h, --help`: Help information\n- `-v, --version`: Version information\n\n## Development\n\n### Prerequisites\n\n- Go 1.25.3 or later\n- [goreleaser](https://goreleaser.com/install/) (for building all platforms)\n\n### Build\n\n```bash\ngo build\n```\n\n### Test\n\n```bash\ngo test -v ./...\n```\n\n### Build for All Platforms (with goreleaser)\n\n```bash\n# Install goreleaser if needed\n# See: https://goreleaser.com/install/\n\n# Build snapshot (all platforms)\ngoreleaser build --snapshot --clean\n\n# Binaries will be in dist/ directory\n```\n\n### Build Manually\n\n```bash\n# Linux AMD64\nGOOS=linux GOARCH=amd64 go build -o yaml2env-linux-amd64\n\n# Linux ARM64\nGOOS=linux GOARCH=arm64 go build -o yaml2env-linux-arm64\n\n# Windows AMD64\nGOOS=windows GOARCH=amd64 go build -o yaml2env-windows-amd64.exe\n\n# Windows ARM64\nGOOS=windows GOARCH=arm64 go build -o yaml2env-windows-arm64.exe\n\n# macOS AMD64\nGOOS=darwin GOARCH=amd64 go build -o yaml2env-darwin-amd64\n\n# macOS ARM64\nGOOS=darwin GOARCH=arm64 go build -o yaml2env-darwin-arm64\n```\n\n## Release Process\n\nReleases are automated using [goreleaser](https://goreleaser.com/) and GitHub Actions:\n\n1. Tag a new version: `git tag -a v1.0.0 -m \"Release v1.0.0\"`\n2. Push the tag: `git push origin v1.0.0`\n3. GitHub Actions will automatically build and publish the release\n\nThe release workflow:\n- Runs all tests\n- Builds binaries for all supported platforms\n- Creates checksums\n- Generates release notes\n- Publishes to GitHub Releases\n\n## License\n\nSee LICENSE file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuberp%2Fyaml2env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuberp%2Fyaml2env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuberp%2Fyaml2env/lists"}