79 lines
2.7 KiB
YAML
79 lines
2.7 KiB
YAML
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
|
|
forgejo-token:
|
|
description: 'Forgejo token for downloading repositories'
|
|
required: false
|
|
default: ${{ env.DEVOPS_FORGEJO_ELYSIUM_ORG_READ_TOKEN }} # Action can't read env, so we need to reset it later
|
|
garden-version:
|
|
description: 'Version of Garden to deploy'
|
|
required: false
|
|
default: 0.13.29
|
|
oasis-branch:
|
|
description: 'Branch of Oasis to use'
|
|
required: false
|
|
default: master
|
|
oasis-workspace:
|
|
descipriont: 'Workspace to setup Oasis'
|
|
required: false
|
|
default: ${{ forgejo.workspace }}/oasis
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Echo Env
|
|
run: env
|
|
# 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
|
|
shell: bash
|
|
run: |
|
|
echo CI_NAMESPACE=ci-$SHORT_COMMIT_SHA >> $GITHUB_ENV
|
|
echo DEVOPS_FORGEJO_ELYSIUM_ORG_READ_TOKEN=${{ inputs.forgejo-token }} >> $GITHUB_ENV
|
|
echo "Checking out Oasis"
|
|
# Checkout Oasis
|
|
- name: Checkout Oasis
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: "elysium/oasis"
|
|
path: ${{ inputs.oasis-workspace }}
|
|
token: ${{ env.DEVOPS_FORGEJO_ELYSIUM_ORG_READ_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
|
|
echo "Finished intalling Garden!"
|
|
# Configure K&S
|
|
- name: Configure K8S
|
|
run: |
|
|
echo "Setup kubeconfig"
|
|
mkdir -p ~/.kube &&
|
|
echo ${{ inputs.kubeconfig }} | base64 -d > ~/.kube/config &&
|
|
chmod 700 ~/.kube/config
|
|
echo "Finished setting up kubeconfig"
|
|
- name: Export Envars
|
|
shell: bash
|
|
run: |
|
|
# Export environment variables
|
|
echo OASIS_WORKSPACE=${{ inputs.oasis-workspace }} >> $GITHUB_ENV
|
|
|