Create an auto-deploy file

This commit is contained in:
Tommy Parnell
2022-06-20 11:15:56 -04:00
parent ede8b595d0
commit 0578adac48

View File

@@ -0,0 +1,60 @@
name: Trigger auto deployment for code-server
# When this action will be executed
on:
# Automatically trigger it when detected changes in repo
push:
branches:
[ main ]
paths:
- '**'
- '.github/workflows/code-server-AutoDeployTrigger-898c9d3f-848e-4e56-8e37-3bb409dc2857.yml'
# Allow mannually trigger
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout to the branch
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to container registry
uses: docker/login-action@v1
with:
registry: terribledevreg.azurecr.io
username: ${{ secrets.CODESERVER_REGISTRY_USERNAME }}
password: ${{ secrets.CODESERVER_REGISTRY_PASSWORD }}
- name: Build and push container image to registry
uses: docker/build-push-action@v2
with:
push: true
tags: terribledevreg.azurecr.io/codecontainerz:${{ github.sha }}
file: ./Dockerfile
context: ./
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.CODESERVER_AZURE_CREDENTIALS }}
- name: Deploy to containerapp
uses: azure/CLI@v1
with:
inlineScript: |
az config set extension.use_dynamic_install=yes_without_prompt
az containerapp registry set -n code-server -g code-server --server terribledevreg.azurecr.io --username ${{ secrets.CODESERVER_REGISTRY_USERNAME }} --password ${{ secrets.CODESERVER_REGISTRY_PASSWORD }}
az containerapp update -n code-server -g code-server --image terribledevreg.azurecr.io/codecontainerz:${{ github.sha }}