Merge pull request #26 from PrincipleStudios/branching-faq #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Main | |
on: | |
push: | |
branches: | |
- main | |
env: | |
azClusterName: PrincipleToolsCluster | |
azClusterResourceGroup: PrincipleK8s | |
registryLoginServer: 'principlestudios.azurecr.io' | |
imageName: 'principle-tools' | |
k8sNamespace: 'principle-tools' | |
releaseName: 'principle-tools' | |
# Secrets generated via ./deployment/generate-credentials.ps1 - need to be reset regularly | |
jobs: | |
build: | |
runs-on: 'ubuntu-latest' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: 'Log in to docker registry' | |
uses: azure/docker-login@v1 | |
with: | |
login-server: ${{ env.registryLoginServer }} | |
username: ${{ secrets.AZ_CLIENT_ID }} | |
password: ${{ secrets.AZ_CLIENT_SECRET }} | |
- name: 'Build and push image' | |
run: | | |
docker build . -t $registryLoginServer/$imageName:${{ github.sha }} --build-arg GIT_HASH=${{ github.sha }} | |
docker push $registryLoginServer/$imageName:${{ github.sha }} | |
# Set the target Azure Kubernetes Service (AKS) cluster. | |
- uses: azure/login@v1 | |
with: | |
creds: '{"clientId":"${{ secrets.AZ_CLIENT_ID }}","clientSecret":"${{ secrets.AZ_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZ_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZ_TENANT_ID }}"}' | |
- name: Set up kubelogin for non-interactive login | |
uses: azure/use-kubelogin@v1 | |
with: | |
kubelogin-version: 'v0.0.28' | |
- uses: azure/aks-set-context@v3 | |
with: | |
cluster-name: ${{ env.azClusterName }} | |
resource-group: ${{ env.azClusterResourceGroup }} | |
admin: 'false' | |
use-kubelogin: 'true' | |
- name: Helm tool installer | |
uses: Azure/setup-helm@v1 | |
with: | |
version: '3.10.0' | |
- name: 'Deploy' | |
run: | | |
helm repo add ps https://principlestudios.github.io/helm-charts | |
helm repo update ps | |
helm upgrade --install -n $k8sNamespace $releaseName --create-namespace --repo https://principlestudios.github.io/helm-charts single-container --set-string "image.repository=$registryLoginServer/$imageName,image.tag=${{ github.sha }}" --values ./deployment/values.yaml --values ./deployment/values.prod.yaml |