elysium-actions/action.yml

84 lines
3.2 KiB
YAML
Raw Normal View History

2024-02-15 16:14:02 -07:00
name: Oasis Auto Config Action
description: Configure env for deploying apps using Oasis Automagically
2024-02-14 22:04:41 -07:00
inputs:
2024-02-15 16:45:22 -07:00
infisical-token:
2024-02-15 19:01:20 -07:00
description: Infisical token for CI or Edge
2024-02-15 16:37:52 -07:00
required: true
2024-08-24 20:06:35 -06:00
infisical-project:
description: Infisical Project For Secrets
required: true
2024-02-14 22:04:41 -07:00
deploy-env:
2024-02-15 16:14:02 -07:00
description: Deploy Environment (ci or edge)
required: true
2024-02-15 16:52:09 -07:00
kubeconfig:
description: Kubeconfig for Oasis
required: false
2024-02-15 17:50:51 -07:00
extra-secret-paths:
description: Additional Secrets to fetch
required: false
extra-secret-envs:
description: Additional Envs for secrets to fetch
required: false
2024-02-14 22:04:41 -07:00
garden-version:
2024-02-15 16:14:02 -07:00
description: Version of Garden to deploy
required: false
2024-02-14 22:04:41 -07:00
oasis-branch:
2024-02-15 16:14:02 -07:00
description: Branch of Oasis to use
required: false
default: master
oasis-workspace:
descipriont: Workspace to setup Oasis
required: false
2024-02-14 22:04:41 -07:00
runs:
2024-02-15 16:48:27 -07:00
using: composite
2024-02-14 22:04:41 -07:00
steps:
- name: Configure Workflow
shell: bash
2024-02-15 16:14:46 -07:00
run: |
2024-02-15 16:14:02 -07:00
if [ ${{ inputs.deploy-env }} == "edge" ]; then
2024-02-18 16:05:29 -07:00
WORKFLOW_SECRET=/workflows/oasis-edge-deploy,/workflows/discord
2024-02-15 16:14:02 -07:00
elif [ ${{ inputs.deploy-env }} == "ci" ]; then
2024-02-18 16:05:29 -07:00
WORKFLOW_SECRET=/workflows/oasis-ci-deploy,/workflows/discord
2024-02-15 16:14:02 -07:00
else
echo "Error! deploy-env required, and must be 'ci' or 'edge'!"
exit 1
fi
2024-02-15 17:50:51 -07:00
# Save Envars
echo OASIS_INFISICAL_TOKEN=${{ inputs.infisical-token }} >> $GITHUB_ENV
2024-02-15 18:07:58 -07:00
echo OASIS_PATH_FETCH=$WORKFLOW_SECRET,${{ inputs.extra-secret-paths }} >> $GITHUB_ENV # /workflows/oasis-<deploy-type>-deploy, ...extra-secret-paths
2024-02-18 16:14:22 -07:00
echo OASIS_ENV_FETCH=${{ inputs.deploy-env }},${{inputs.deploy-env}},${{ inputs.extra-secret-envs }} >> $GITHUB_ENV #<deploy-type>, ...extra-secret-envs
2024-02-14 22:04:41 -07:00
- name: Setup Oasis Envars
2024-08-24 17:10:44 -06:00
uses: https://forgejo.dunemask.dev/elysium/elysium-actions@infisical-env
2024-02-14 22:04:41 -07:00
with:
2024-02-15 10:31:21 -07:00
infisical-token: ${{ env.OASIS_INFISICAL_TOKEN }}
2024-08-24 20:11:54 -06:00
project-id: ${{ inputs.infisical-project }}
2024-02-15 18:07:23 -07:00
secret-envs: ${{ env.OASIS_ENV_FETCH }}
2024-02-15 17:50:51 -07:00
secret-paths: ${{ env.OASIS_PATH_FETCH }}
2024-02-15 10:31:21 -07:00
- name: Configure Kubeconfig
2024-02-15 16:14:02 -07:00
shell: bash
2024-02-15 16:14:46 -07:00
run: |
2024-02-15 18:13:12 -07:00
if [ -n "${{ inputs.kubeconfig }}" ] && [ "${{ inputs.kubeconfig }}" != "" ]; then
2024-02-15 16:55:46 -07:00
echo "Using Provided Kubernetes Config"
echo OASIS_WORKFLOW_KUBECONFIG=${{ inputs.kubeconfig }} >> $GITHUB_ENV
2024-02-15 18:13:12 -07:00
elif [ "${{ inputs.deploy-env }}" == "edge" ]; then
2024-02-15 16:53:30 -07:00
echo "Using Edge Kubernetes Config"
2024-02-15 16:14:02 -07:00
echo OASIS_WORKFLOW_KUBECONFIG=${{env.KUBERNETES_CONFIG_USW_EDGE}} >> $GITHUB_ENV
2024-02-15 18:13:12 -07:00
elif [ "${{ inputs.deploy-env }}" == "ci" ]; then
2024-02-15 16:53:30 -07:00
echo "Using Dev Kubernetes Config"
2024-02-15 16:25:09 -07:00
echo OASIS_WORKFLOW_KUBECONFIG=${{env.KUBERNETES_CONFIG_USW_DEV}} >> $GITHUB_ENV
2024-02-15 16:14:02 -07:00
else
echo "Error! deploy-env required, and must be 'ci' or 'edge'!"
exit 1
fi
2024-08-25 16:00:00 -06:00
- name: After
run: echo "I'm after"
2024-02-15 10:31:21 -07:00
- name: Oasis Setup
2024-08-24 17:10:44 -06:00
uses: https://forgejo.dunemask.dev/elysium/elysium-actions@oasis-setup-advanced
2024-02-15 10:31:21 -07:00
with:
2024-02-15 10:36:39 -07:00
garden-version: ${{ inputs.garden-version }}
oasis-branch: ${{ inputs.oasis-branch }}
oasis-workspace: ${{ inputs.oasis-workspace }}
2024-02-15 10:31:21 -07:00
kubeconfig: ${{ env.OASIS_WORKFLOW_KUBECONFIG }}
2024-08-25 15:55:56 -06:00
- name: After
run: echo "I'm after"