elysium-actions/action.yml

78 lines
2.7 KiB
YAML
Raw Normal View History

2024-08-25 16:04:59 -06:00
name: "Oasis Config Action"
description: "Configure env for deploying apps using Oasis"
2024-02-13 16:25:01 -07:00
inputs:
kubeconfig:
2024-08-25 16:04:59 -06:00
description: "A base64 encoded string of the kubeconfig to use. Required!"
required: true
2024-08-24 20:27:56 -06:00
forgejo-token:
2024-08-25 16:04:59 -06:00
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
2024-02-13 16:25:01 -07:00
garden-version:
2024-08-25 16:04:59 -06:00
description: "Version of Garden to deploy"
required: false
default: 0.13.29
2024-02-13 16:25:01 -07:00
oasis-branch:
2024-08-25 16:04:59 -06:00
description: "Branch of Oasis to use"
required: false
default: master
oasis-workspace:
descipriont: "Workspace to setup Oasis"
required: false
default: oasis
2024-02-13 16:25:01 -07:00
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
2024-02-14 20:43:59 -07:00
shell: bash
2024-02-13 16:25:01 -07:00
run: |
echo CI_NAMESPACE=ci-$SHORT_COMMIT_SHA >> $GITHUB_ENV
2024-08-24 20:27:56 -06:00
echo DEVOPS_FORGEJO_ELYSIUM_ORG_READ_TOKEN=${{ inputs.forgejo-token }} >> $GITHUB_ENV
2024-02-14 21:40:14 -07:00
echo "Checking out Oasis"
2024-08-25 16:04:59 -06:00
# Checkout Oasis
2024-02-13 16:25:01 -07:00
- name: Checkout Oasis
2024-08-25 14:53:09 -06:00
uses: actions/checkout@v4
2024-02-13 16:25:01 -07:00
with:
repository: "elysium/oasis"
path: ${{ inputs.oasis-workspace }}
2024-08-24 20:27:56 -06:00
token: ${{ env.DEVOPS_FORGEJO_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
2024-02-14 21:40:14 -07:00
echo "Finished intalling Garden!"
2024-02-13 16:25:01 -07:00
# Configure K&S
- name: Configure K8S
run: |
echo "Setup kubeconfig"
mkdir -p ~/.kube &&
2024-02-14 21:38:04 -07:00
echo ${{ inputs.kubeconfig }} | base64 -d > ~/.kube/config &&
2024-02-14 21:40:14 -07:00
chmod 700 ~/.kube/config
echo "Finished setting up kubeconfig"
2024-02-13 16:25:01 -07:00
- name: Export Envars
shell: bash
run: |
# Export environment variables
2024-08-25 16:01:17 -06:00
echo "OASIS_WORKSPACE=${{ inputs.oasis-workspace }}"
2024-08-25 15:53:46 -06:00
echo OASIS_WORKSPACE=${{ inputs.oasis-workspace }} >> $GITHUB_ENV