Workflow file for this run
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: Build and push the tagged build to production | |
on: | |
push: | |
tags: | |
- 'v*' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build_push_image: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Fetch latest version | |
id: fetch_version | |
run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} | |
- name: Set up Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker Login | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ secrets.ACR_NAME }} | |
username: ${{ secrets.ACR_LOGIN }} | |
password: ${{ secrets.ACR_PASSWORD }} | |
- name: Build and push production images | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
tags: ${{secrets.ACR_NAME}}/csssh:latest,${{secrets.ACR_NAME}}/csssh:${{ steps.fetch_version.outputs.TAG }} | |
push: true | |
secrets: | | |
CSSSH_SSH_HOST_ECDSA_KEY=${{ secrets.CSSSH_SSH_HOST_ECDSA_KEY }} | |
CSSSH_SSH_HOST_ECDSA_KEY_PUB=${{ secrets.CSSSH_SSH_HOST_ECDSA_KEY_PUB }} | |
CSSSH_SSH_HOST_ED25519_KEY=${{ secrets.CSSSH_SSH_HOST_ED25519_KEY }} | |
CSSSH_SSH_HOST_ED25519_KEY_PUB=${{ secrets.CSSSH_SSH_HOST_ED25519_KEY_PUB }} | |
CSSSH_SSH_HOST_RSA_KEY=${{ secrets.CSSSH_SSH_HOST_RSA_KEY }} | |
CSSSH_SSH_HOST_RSA_KEY_PUB=${{ secrets.CSSSH_SSH_HOST_RSA_KEY_PUB }} | |
deploy: | |
runs-on: ubuntu-20.04 | |
needs: build_push_image | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Helm | |
uses: Azure/setup-helm@v3 | |
with: | |
version: latest | |
- name: Get AKS Credentials | |
uses: Azure/aks-set-context@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
# Resource group name | |
resource-group: CS_Infrastructure_AKS | |
# AKS cluster name | |
cluster-name: Infrastructure | |
- name: Run Helm Deploy | |
run: | | |
helm upgrade \ | |
--install \ | |
--create-namespace \ | |
--atomic \ | |
--wait \ | |
--namespace production \ | |
csssh \ | |
./kubernetes/csssh \ | |
--set image.repository=${{ secrets.ACR_NAME }} \ | |
--set image.tag=${GITHUB_REF##*/} |