-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding changes required for fully integrated SLV action
- Loading branch information
0 parents
commit 670fc5e
Showing
15 changed files
with
40,668 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"env": { | ||
"commonjs": true, | ||
"es6": true, | ||
"jest": true, | ||
"node": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"globals": { | ||
"Atomics": "readonly", | ||
"SharedArrayBuffer": "readonly" | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": "latest" | ||
}, | ||
"rules": { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
env: | ||
KNOWN_TEST_SECRET: Kuwan | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [macos-latest, windows-latest, ubuntu-latest] | ||
version: [0.2.0] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup SLV | ||
uses: ./ | ||
with: | ||
version: ${{ matrix.version }} | ||
|
||
- name: Capture SLV Version Installed | ||
run: | | ||
echo "SLV_VERSION_INSTALLED=$(slv --version | grep "SLV Version" | awk '{print $4}')" >> $GITHUB_ENV | ||
- name: Verify SLV Version | ||
shell: python | ||
env: | ||
SLV_VERSION_EXPECTED: ${{ matrix.version }} | ||
run: | | ||
import sys, os | ||
sys.exit( | ||
int(not os.environ["SLV_VERSION_EXPECTED"] in os.environ["SLV_VERSION_INSTALLED"]) | ||
) | ||
- name: Add a known secret to existing vault | ||
run: | | ||
slv vault put -v pets.slv.yml --name AWESOME_CAT --secret "$KNOWN_TEST_SECRET" | ||
cat pets.slv.yml | ||
- name: Load SLV Secrets | ||
uses: ./ | ||
with: | ||
vault: pets.slv.yml | ||
env-secret-key: ${{ secrets.SLV_ENV_SECRET_KEY }} | ||
prefix: "MY_" | ||
|
||
- name: Verify SLV Secrets | ||
shell: python | ||
run: | | ||
import sys, os | ||
sys.exit( | ||
int(not os.environ["MY_AWESOME_CAT"] in os.environ["KNOWN_TEST_SECRET"]) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Amagi Media Labs | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# :gear: `slv-action` ![](https://github.com/amagioss/slv-action/workflows/Tests/badge.svg) | ||
> This action downloads and sets up the [SLV][slv] CLI and helps in injecting vault secrets as masked environment variables for workflows to consume. | ||
## About | ||
This action can be run on `ubuntu-latest`, `windows-latest`, and `macos-latest` GitHub Actions runners, and will install and expose the specified version of the [`slv`](slv) CLI on the runner environment. | ||
|
||
## Usage | ||
|
||
Only setup the [`slv`](slv) CLI: | ||
|
||
```yaml | ||
steps: | ||
- name: Setup SLV | ||
uses: amagioss/slv-action@main | ||
``` | ||
A specific version of the [`slv`](slv) CLI can also be installed: | ||
|
||
```yaml | ||
steps: | ||
- name: Setup SLV | ||
uses: amagioss/slv-action@main | ||
with: | ||
version: 0.1.5 | ||
``` | ||
|
||
Load SLV secrets into environment variables: | ||
|
||
```yaml | ||
steps: | ||
- name: Load SLV Secrets | ||
uses: amagioss/slv-action@main | ||
with: | ||
vault: pets.slv.yml | ||
env-secret-key: ${{ secrets.SLV_ENV_SECRET_KEY }} | ||
``` | ||
|
||
Optionally specify a prefix that will be added to the environment variables in front of the secret names: | ||
|
||
```yaml | ||
steps: | ||
- name: Load SLV Secrets - PROD | ||
uses: amagioss/slv-action@main | ||
with: | ||
version: 0.1.5 | ||
vault: pets.slv.yml | ||
env-secret-key: ${{ secrets.SLV_ENV_SECRET_KEY }} | ||
prefix: "PROD_" | ||
``` | ||
|
||
## Inputs | ||
The actions supports the following inputs: | ||
|
||
- `version`: The version of `slv` to install, defaulting to `latest` | ||
- `vault`: Path to the vault file | ||
- `env-secret-key`: The SLV environment secret (key/binding) to use for the action | ||
- `prefix`: Prefix to use for the environment variable names along with the SLV secret name | ||
|
||
[slv]: https://github.com/amagioss/slv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: slv-action | ||
description: Sets up the SLV CLI and helps in injecting vault secrets as masked environment variables for workflows to consume. | ||
inputs: | ||
version: | ||
description: Version of SLV to install | ||
required: false | ||
default: latest | ||
github-token: | ||
description: GitHub token to use for downloading SLV (To avoid rate-limits) | ||
required: false | ||
default: ${{ github.token }} | ||
vault: | ||
description: Path to the vault file | ||
required: false | ||
env-secret-key: | ||
description: SLV environment secret key | ||
required: false | ||
prefix: | ||
description: Prefix to use for the environment variable names along with the SLV secret name | ||
required: false | ||
branding: | ||
icon: 'unlock' | ||
color: 'white' | ||
runs: | ||
using: node20 | ||
main: dist/index.js |
Oops, something went wrong.