Create an auto-deploy file
This commit is contained in:
60
.github/workflows/code-server-app-AutoDeployTrigger-b75dfe37-07c8-4654-a996-77591661b188.yml
vendored
Normal file
60
.github/workflows/code-server-app-AutoDeployTrigger-b75dfe37-07c8-4654-a996-77591661b188.yml
vendored
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
name: Trigger auto deployment for code-server-app
|
||||||
|
|
||||||
|
# When this action will be executed
|
||||||
|
on:
|
||||||
|
# Automatically trigger it when detected changes in repo
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
[ main ]
|
||||||
|
paths:
|
||||||
|
- '**'
|
||||||
|
- '.github/workflows/code-server-app-AutoDeployTrigger-b75dfe37-07c8-4654-a996-77591661b188.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.CODESERVERAPP_REGISTRY_USERNAME }}
|
||||||
|
password: ${{ secrets.CODESERVERAPP_REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push container image to registry
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
tags: terribledevreg.azurecr.io/code-server-app:${{ github.sha }}
|
||||||
|
file: ./Dockerfile
|
||||||
|
context: ./
|
||||||
|
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Azure Login
|
||||||
|
uses: azure/login@v1
|
||||||
|
with:
|
||||||
|
creds: ${{ secrets.CODESERVERAPP_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-app -g code-server-app --server terribledevreg.azurecr.io --username ${{ secrets.CODESERVERAPP_REGISTRY_USERNAME }} --password ${{ secrets.CODESERVERAPP_REGISTRY_PASSWORD }}
|
||||||
|
az containerapp update -n code-server-app -g code-server-app --image terribledevreg.azurecr.io/code-server-app:${{ github.sha }}
|
||||||
Reference in New Issue
Block a user