amend CD workflow for testing #2
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: CD | |
on: | |
push: | |
branches: | |
- main | |
# added for testing - remove when successful | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Log in to Azure CLI | |
- name: Log in via Azure CLI | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
# Log in to Azure Container Registry | |
- name: Log in to Azure Container Registry | |
uses: azure/docker-login@v1 | |
with: | |
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }} | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
# Build and push server image | |
- name: Build and push server image | |
run: | | |
docker build -t server:latest ./server | |
docker tag server:latest ${{ secrets.REGISTRY_LOGIN_SERVER }}/server:latest | |
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/server:latest | |
# Build and push client image | |
- name: Build and push client image | |
run: | | |
docker build -t client:latest ./client | |
docker tag client:latest ${{ secrets.REGISTRY_LOGIN_SERVER }}/client:latest | |
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/client:latest | |
# FOR FUTURE USE AND DEPLOYMENTS | |
# reference: https://learn.microsoft.com/en-us/azure/container-instances/container-instances-github-action | |
# # Deploy to Azure Container Instances (only on main branch) | |
# - name: Deploy to Azure Container Instances | |
# uses: azure/aci-deploy@v1 | |
# with: | |
# resource-group: ${{ secrets.RESOURCE_GROUP }} | |
# dns-name-label: ${{ secrets.RESOURCE_GROUP }}${{ github.run_number }} | |
# image: ${{ secrets.REGISTRY_LOGIN_SERVER }}/sampleapp:${{ github.sha }} | |
# registry-login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }} | |
# registry-username: ${{ secrets.REGISTRY_USERNAME }} | |
# registry-password: ${{ secrets.REGISTRY_PASSWORD }} | |
# name: aci-sampleapp | |
# location: 'westus' |