Files
battleship/.github/workflows/cd-backend.yml
2024-09-26 00:19:08 +05:30

47 lines
1.2 KiB
YAML

name: Deploy
on:
push:
tags:
- v**
workflow_dispatch:
jobs:
docker:
runs-on: ubuntu-latest
environment: battleship
steps:
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ secrets.DOCKER_IMAGE_PATH }}:${{ github.sha }}
cache-from: type=registry,ref=${{ secrets.DOCKER_IMAGE_PATH }}:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_IMAGE_PATH }}:buildcache,mode=max
-
name: Login to Azure
uses: azure/login@v1
env:
CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
with:
creds: $CREDENTIALS
-
name: Deploy Container
uses: azure/container-apps-deploy-action@v1
with:
acrName: dockerhub
containerAppName: battleship
resourceGroup: Battleship
imageToDeploy: ${{ secrets.DOCKER_IMAGE_PATH }}:${{ github.sha }}