elysium-actions/action.yml

82 lines
2.9 KiB
YAML
Raw Normal View History

2024-02-13 16:25:01 -07:00
name: 'Oasis Config Action'
description: 'Configure env for deploying apps using Oasis'
inputs:
kubeconfig:
description: 'A base64 encoded string of the kubeconfig to use. Required!'
required: true
gitea-token:
description: 'Gitea token for downloading repositories'
2024-02-13 23:46:09 -07:00
required: false
2024-02-15 03:18:12 +00:00
# default: ${{ env.DEVOPS_GITEA_ELYSIUM_ORG_READ_TOKEN }} # Action can't read this as a default, so we've gotta do a check later
2024-02-13 16:25:01 -07:00
garden-version:
description: 'Version of Garden to deploy'
required: false
default: 0.13.24
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:
# Set additional Envars
- name: Setting Short Commit Sha
run: echo SHORT_COMMIT_SHA=$(echo $GITHUB_SHA | cut -c 1-6) >> $GITHUB_ENV
- name: Setup Enviornment Variables
run: |
2024-02-14 20:41:56 -07:00
echo "OLD: ${{ env.DEVOPS_GITEA_ELYSIUM_ORG_READ_TOKEN }}"
2024-02-13 16:25:01 -07:00
echo CI_NAMESPACE=ci-$SHORT_COMMIT_SHA >> $GITHUB_ENV
2024-02-15 03:18:12 +00:00
if [ ! -z "${{ inputs.gitea-token }}" -a "${{ inputs.gitea-token }}" != " " ]; then
2024-02-15 03:24:29 +00:00
echo "Somehow setting? ${{ inputs.gitea-token }}"
2024-02-15 03:18:12 +00:00
echo DEVOPS_GITEA_ELYSIUM_ORG_READ_TOKEN=${{ inputs.gitea-token }} >> $GITHUB_ENV
fi
2024-02-15 03:26:01 +00:00
echo "Ans so I CRI sometimes cuz I got right here and I echo this var '$DEVOPS_GITEA_ELYSIUM_ORG_READ_TOKEN'"
2024-02-15 03:19:39 +00:00
2024-02-13 16:25:01 -07:00
# Checkout Oasis
- name: Checkout Oasis
uses: actions/checkout@v3
with:
repository: "elysium/oasis"
path: ${{ inputs.oasis-workspace }}
2024-02-15 03:23:43 +00:00
token: ${{ env.DEVOPS_GITEA_ELYSIUM_ORG_READ_TOKEN }}
2024-02-13 16:25:01 -07:00
ref: ${{ inputs.oasis-branch }}
- name: Download Garden
shell: bash
env:
GARDEN_BIN_VERSION: ${{ inputs.garden-version }}
GARDEN_DIR: ${{ runner.temp }}/garden
run: |
# Install Garden
mkdir -p "$GARDEN_DIR"
cd "$GARDEN_DIR"
if ! [ -d "$GARDEN_BIN_VERSION" ]; then
echo "Downloading ${GARDEN_BIN_VERSION}..."
if [[ "$GARDEN_BIN_VERSION" = "latest" ]]; then
tag_param=""
else
tag_param="$GARDEN_BIN_VERSION"
fi
fi
curl -sL https://get.garden.io/install.sh | bash -s -- $tag_param
echo PATH=$PATH:$HOME/.garden/bin >> $GITHUB_ENV
git config --global --add safe.directory $HOME/.garden/bin/static
# Configure K&S
- name: Configure K8S
run: |
echo "Setup kubeconfig"
mkdir -p ~/.kube &&
echo "${KUBECONFIG_BASE64}" | base64 -d > ~/.kube/config &&
chmod 700 ~/.kube/config
env:
KUBECONFIG_BASE64: ${{ inputs.kubeconfig }}
- name: Export Envars
shell: bash
run: |
# Export environment variables
echo OASIS_WORKSPACE=${{ inputs.oasis-workspace }} >> $GITHUB_ENV