Skip to content

NC Deploy on Branch #50

NC Deploy on Branch

NC Deploy on Branch #50

name: NC Deploy on Branch
# Notice: Branch name can not be longer than 28 chars, otherwise cert-manager fails
# cd schulcloud-nextcloud
# gh workflow run nextcloud-branch-deployment.yml --ref <branch-name> -f NAMESPACE_SCHULCLOUD_INSTANCE=<myvalue>
on:
workflow_dispatch:
inputs:
NAMESPACE_SCHULCLOUD_INSTANCE:
description: 'Namespace name of schulcloud instance in the sc-dev-* cluster'
required: true
INSTANCE_NAME:
description: 'select nbc, brb or thr'
required: true
jobs:
get_branch_name:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.extract_branch.outputs.branch }}
steps:
- name: Extract branch name
shell: bash
run: |
branch_name=$(echo "branch=${GITHUB_REF#refs/heads/}")
echo "branch_name=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
# renames branch to valid namespace name
# namespaces name constraints: at most 63 characters(only lowercase alphanumeric) or '-'
namespace_name=$(echo $branch_name | sed 's@.*/@@' | tr [A-Z] [a-z] | tr _ - | tr \. -)
echo "before regex:" $branch_name "after regex:" $namespace_name
echo "$namespace_name" >> $GITHUB_OUTPUT
id: extract_branch
deploy_nextcloud_from_branch:
if: ${{ needs.get_branch_name.outputs.branch }} != 'main'
needs:
- get_branch_name
uses: ./.github/workflows/nextcloud-deploy.yml
with:
CLUSTER: sc-dev-nextcloud
BUCKET_NAME: ${{ needs.get_branch_name.outputs.branch }}
NAMESPACE: ${{ needs.get_branch_name.outputs.branch }}
NAMESPACE_SCHULCLOUD_INSTANCE: ${{ inputs.NAMESPACE_SCHULCLOUD_INSTANCE }}
INSTANCE_NAME: ${{ inputs.INSTANCE_NAME }}
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
KUBECONFIG: ${{ secrets.KUBECONFIG }}
SOCIALLOGINCLIENTID: ${{ secrets.DEV_SOCIALLOGINCLIENTID }}
SOCIALLOGINSECRET: ${{ secrets.DEV_SOCIALLOGINSECRET }}
S3ACCESSKEY: ${{ secrets.S3ACCESSKEY }}
S3ACCESSSECRET: ${{ secrets.S3ACCESSSECRET }}
PROXY_CREDENTIALS: ${{ secrets.PROXY_CREDENTIALS }}