Github action basic #13
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
name: Test GHA with Keeper | |
# Triggers the workflow manually from the GitHub Actions tab | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build and Retrieve Secrets | |
environment: test | |
runs-on: ubuntu-latest # The type of runner that the job will execute on | |
steps: | |
# Step 1: Retrieve secrets from Keeper | |
- name: Retrieve secrets from Keeper | |
id: ksecrets # This ID will be used to reference outputs from this step | |
uses: Keeper-Security/ksm-action@master | |
with: | |
keeper-secret-config: ${{ secrets.KSM_CONFIG }} # Secret config needed to access Keeper | |
secrets: |- | |
GzPJKNrw4TAvdX29NORoXA/title > REC_TITLE | |
GzPJKNrw4TAvdX29NORoXA/type > REC_TYPE | |
GzPJKNrw4TAvdX29NORoXA/field/login > LOGIN | |
GzPJKNrw4TAvdX29NORoXA/field/password > PASSWORD | |
GzPJKNrw4TAvdX29NORoXA/custom_field/ExampleMultilineText > env:ExampleMultilineText | |
GzPJKNrw4TAvdX29NORoXA/file/command.txt > file:/tmp/cmd.txt | |
GitHub Action: Keeper Demo - Login/field/login > env:LOGIN2 | |
GitHub Action: Keeper Demo - Login/field/password > env:PASSWORD2 | |
# GitHub Action: Keeper Demo - Login/file/image.png > file:/tmp/img.png | |
# Step 2: Print and Reverse Step Output Variables | |
- name: Print and Reverse Step Output Variables | |
run: | | |
echo "Record Title is: $(echo '${{ steps.ksecrets.outputs.REC_TITLE }}' | rev)" | |
echo "Record Type is: $(echo '${{ steps.ksecrets.outputs.REC_TYPE }}' | rev)" | |
echo "Login is: $(echo '${{ steps.ksecrets.outputs.LOGIN }}' | rev)" | |
echo "Password is: $(echo '${{ steps.ksecrets.outputs.PASSWORD }}' | rev)" | |
# Step 3: Print and Reverse Environment Variables | |
- name: Print and Reverse Environment Variables | |
run: | | |
echo "ExampleMultilineText is: $(echo '${{ env.ExampleMultilineText }}' | rev)" | |
echo "Login2 is: $(echo '${{ env.LOGIN2 }}' | rev)" | |
echo "Password2 is: $(echo '${{ env.PASSWORD2 }}' | rev)" | |
# Step 4: Print Reversed File Content | |
- name: Print Reversed File Content | |
run: | | |
rev /tmp/cmd.txt |