Skip to content

Merge pull request #851 from crowdbotics/qa #29

Merge pull request #851 from crowdbotics/qa

Merge pull request #851 from crowdbotics/qa #29

Workflow file for this run

name: build-deploy
on:
push:
branches:
- develop
tags:
- "[0-9]+.[0-9]+"
jobs:
set_environment:
outputs:
my_env: ${{ steps.setenv.outputs.my_env }}
tag: ${{ steps.setenv.outputs.tag }}
runs-on: ubuntu-latest
steps:
- id: setenv
run: |
if [ $GITHUB_REF_NAME == develop ]; then
echo "my_env=dev" >> $GITHUB_OUTPUT
echo "tag=$GITHUB_REF_NAME" >> $GITHUB_OUTPUT
fi
if [[ $GITHUB_REF_NAME =~ ^[0-9]+\.[0-9]+$ ]]; then
echo "release tag: $GITHUB_REF_NAME"
echo "tag=$GITHUB_REF_NAME" >> $GITHUB_OUTPUT
echo "my_env=production" >> $GITHUB_OUTPUT
fi
release:
runs-on: ubuntu-latest
needs: set_environment
environment:
name: ${{ needs.set_environment.outputs.my_env }}
name: ${{ needs.set_environment.outputs.my_env }}-release
steps:
- name: Clone Reusable Actions Repo
run: |
git clone -b master https://${{ secrets.GIT_TOKEN }}@github.com/crowdbotics/github-actions.git
- name: Azure login
uses: azure/[email protected]
with:
creds: "${{ secrets.AZURE_CREDENTIALS }}"
- name: Set up kubelogin for non-interactive login
uses: azure/use-kubelogin@v1
with:
kubelogin-version: "v0.0.25"
- name: Get K8s context
uses: azure/aks-set-context@v4
with:
resource-group: ${{ secrets.AZURE_RESOURCE_GROUP }}
cluster-name: ${{ secrets.AZURE_CLUSTER_NAME }}
admin: "false"
use-kubelogin: "true"
- name: Update DJANGO_SCAFFOLD_REPO_BRANCH
id: update-env-var
uses: ./github-actions/set-azure-env-var
with:
resource_group: ${{ secrets.AZURE_RESOURCE_GROUP }}
cluster_name: ${{ secrets.AZURE_CLUSTER_NAME }}
app_name: crowdbotics-app
app_namespace: cb-core
env_var: DJANGO_SCAFFOLD_REPO_BRANCH
env_value: ${{ needs.set_environment.outputs.tag }}
token: ${{ secrets.GIT_TOKEN }}
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
- uses: act10ns/slack@v2
if: ${{ needs.set_environment.outputs.my_env }} == 'production'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}