elysium-actions/action.yml

76 lines
2.5 KiB
YAML
Raw Normal View History

2024-02-13 16:18:53 -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'
required: true
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: |
echo CI_NAMESPACE=ci-$SHORT_COMMIT_SHA >> $GITHUB_ENV
echo REPO_GITEA_TOKEN_RO=$GITEA_TOKEN >> $GITHUB_ENV
env:
GITEA_TOKEN: ${{ inputs.gitea-token }}
# Checkout Oasis
- name: Checkout Oasis
uses: actions/checkout@v3
with:
repository: "elysium/oasis"
path: ${{ inputs.oasis-workspace }}
token: ${{ inputs.gitea-token}}
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