elysium-actions/action.yml

78 lines
2.7 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
2024-08-24 20:27:56 -06:00
forgejo-token:
description: 'Forgejo token for downloading repositories'
2024-02-13 23:46:09 -07:00
required: false
2024-08-24 20:27:56 -06:00
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:
description: 'Version of Garden to deploy'
required: false
2024-04-07 02:43:01 +00:00
default: 0.13.29
2024-02-13 16:25:01 -07:00
oasis-branch:
description: 'Branch of Oasis to use'
required: false
default: master
oasis-workspace:
descipriont: 'Workspace to setup Oasis'
required: false
2024-08-24 20:27:56 -06:00
default: ${{ forgejo.workspace }}/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-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-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
echo OASIS_WORKSPACE=${{ inputs.oasis-workspace }} >> $GITHUB_ENV