diff --git a/README.md b/README.md index e4fd7c2..0e57a58 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,9 @@ The actions are used by Elysium to run CI/CD tasks and this repo will be archive The actions available are: - [S3 Backup](https://gitea.dunemask.dev/elysium/elysium-actions/src/branch/s3-backup/action.yml) -- [Oasis Deploy](https://gitea.dunemask.dev/elysium/elysium-actions/src/branch/oasis-deploy/action.yml) +- [Oasis Auto Setup](https://gitea.dunemask.dev/elysium/elysium-actions/src/branch/oasis-setup-auto/action.yml) - [Infisical Env](https://gitea.dunemask.dev/elysium/elysium-actions/src/branch/infisical-env/action.yml) +- [Oasis Advanced Setup](https://gitea.dunemask.dev/elysium/elysium-actions/src/branch/oasis-setup-advanced/action.yml) - [Elysium CI/CD](https://gitea.dunemask.dev/elysium/elysium-actions/src/branch/elysium-ci-cd/action.yml) ## Workflow Template diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..da6cea8 --- /dev/null +++ b/action.yml @@ -0,0 +1,80 @@ +name: Oasis Auto Config Action +description: Configure env for deploying apps using Oasis Automagically +inputs: + infisical-token: + description: Infisical token for CI or Edge + required: true + infisical-project: + description: Infisical Project For Secrets + required: true + deploy-env: + description: Deploy Environment (ci or edge) + required: true + kubeconfig: + description: Kubeconfig for Oasis + required: false + extra-secret-paths: + description: Additional Secrets to fetch + required: false + extra-secret-envs: + description: Additional Envs for secrets to fetch + required: false + garden-version: + description: Version of Garden to deploy + required: false + oasis-branch: + description: Branch of Oasis to use + required: false + default: master + oasis-workspace: + descipriont: Workspace to setup Oasis + required: false + default: ${{ gitea.workspace }}/oasis +runs: + using: composite + steps: + - name: Configure Workflow + shell: bash + run: | + if [ ${{ inputs.deploy-env }} == "edge" ]; then + WORKFLOW_SECRET=/workflows/oasis-edge-deploy,/workflows/discord + elif [ ${{ inputs.deploy-env }} == "ci" ]; then + WORKFLOW_SECRET=/workflows/oasis-ci-deploy,/workflows/discord + else + echo "Error! deploy-env required, and must be 'ci' or 'edge'!" + exit 1 + fi + # Save Envars + echo OASIS_INFISICAL_TOKEN=${{ inputs.infisical-token }} >> $GITHUB_ENV + echo OASIS_PATH_FETCH=$WORKFLOW_SECRET,${{ inputs.extra-secret-paths }} >> $GITHUB_ENV # /workflows/oasis--deploy, ...extra-secret-paths + echo OASIS_ENV_FETCH=${{ inputs.deploy-env }},${{inputs.deploy-env}},${{ inputs.extra-secret-envs }} >> $GITHUB_ENV #, ...extra-secret-envs + - name: Setup Oasis Envars + uses: https://forgejo.dunemask.dev/elysium/elysium-actions@infisical-env + with: + infisical-token: ${{ env.OASIS_INFISICAL_TOKEN }} + project-id: ${{ inputs.infisical-project }} + secret-envs: ${{ env.OASIS_ENV_FETCH }} + secret-paths: ${{ env.OASIS_PATH_FETCH }} + - name: Configure Kubeconfig + shell: bash + run: | + if [ -n "${{ inputs.kubeconfig }}" ] && [ "${{ inputs.kubeconfig }}" != "" ]; then + echo "Using Provided Kubernetes Config" + echo OASIS_WORKFLOW_KUBECONFIG=${{ inputs.kubeconfig }} >> $GITHUB_ENV + elif [ "${{ inputs.deploy-env }}" == "edge" ]; then + echo "Using Edge Kubernetes Config" + echo OASIS_WORKFLOW_KUBECONFIG=${{env.KUBERNETES_CONFIG_USW_EDGE}} >> $GITHUB_ENV + elif [ "${{ inputs.deploy-env }}" == "ci" ]; then + echo "Using Dev Kubernetes Config" + echo OASIS_WORKFLOW_KUBECONFIG=${{env.KUBERNETES_CONFIG_USW_DEV}} >> $GITHUB_ENV + else + echo "Error! deploy-env required, and must be 'ci' or 'edge'!" + exit 1 + fi + - name: Oasis Setup + uses: https://forgejo.dunemask.dev/elysium/elysium-actions@oasis-setup-advanced + with: + garden-version: ${{ inputs.garden-version }} + oasis-branch: ${{ inputs.oasis-branch }} + oasis-workspace: ${{ inputs.oasis-workspace }} + kubeconfig: ${{ env.OASIS_WORKFLOW_KUBECONFIG }}