From b0be364abf09acd4c8ab3e2cf9036be449d7c98a Mon Sep 17 00:00:00 2001 From: dunemask Date: Sat, 19 Aug 2023 23:41:30 +0000 Subject: [PATCH] Add .gitea/workflows/deploy-edge.yml (#5) Reviewed-on: https://gitea.dunemask.net/elysium/nile/pulls/5 --- .gitea/workflows/deploy-edge.yml | 59 ++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .gitea/workflows/deploy-edge.yml diff --git a/.gitea/workflows/deploy-edge.yml b/.gitea/workflows/deploy-edge.yml new file mode 100644 index 0000000..6b71843 --- /dev/null +++ b/.gitea/workflows/deploy-edge.yml @@ -0,0 +1,59 @@ +name: Deploy Edge +run-name: ${{ gitea.actor }} Deploy Edge +on: + push: + branches: [ master ] + +env: + GITEA_TOKEN: ${{ secrets.ELYSIUM_ORG_READ_TOKEN }} + GARDEN_DEPLOY_ACTION: deploy.nile + OASIS_PROD_CONFIG: ${{ secrets.OASIS_PROD_CONFIG }} + OASIS_DIR: ${{ gitea.workspace}}/oasis + OASIS_BRANCH: master + KUBECONFIG_BASE64: ${{ secrets.KUBECONFIG_USW_EDGE }} + +jobs: + oasis-testing: + steps: + # Setup 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 + - name: "Using CI env $CI_NAMESPACE" + run: echo $CI_NAMESPACE + # Checkout Oasis + - name: Checkout Oasis + run: git clone --depth=1 --branch $OASIS_BRANCH "https://dunemask:$GITEA_TOKEN@gitea.dunemask.net/dunemask/oasis.git" $OASIS_DIR + - run: echo "Cloned Oasis 🌴" + - name: Install Kubectl + run: | + curl -LO https://storage.googleapis.com/kubernetes-release/release/\ + $(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)\ + /bin/linux/amd64/kubectl && \ + chmod +x ./kubectl && \ + mv ./kubectl /usr/local/bin/kubectl + # Install Garden + - name: Install Garden 🌸 + run: | + curl -sL https://get.garden.io/install.sh | bash && + ln -sfn $HOME/.garden/bin/garden /usr/local/bin/garden && + git config --global --add safe.directory $HOME/.garden/bin/static + # Configure K&S + - name: Configure K8S + run: | + mkdir -p ~/.kube && + echo "${KUBECONFIG_BASE64}" | base64 -d > ~/.kube/config && + chmod 700 ~/.kube/config + - name: Configure Prod config + run: | + echo "${OASIS_PROD_CONFIG}" | base64 -d > garden-config/prod.yml + working-directory: ${{ env.OASIS_DIR}} + - name: Deploy to Edge env + run: garden deploy $GARDEN_DEPLOY_ACTION --env usw-edge + working-directory: ${{ env.OASIS_DIR }} + - name: Status Alert + if: always() + run: echo "The Job ended with status ${{ job.status }}." \ No newline at end of file