Skip to content

Update deploy_to_ghcr_custom_tag.yaml #1

Update deploy_to_ghcr_custom_tag.yaml

Update deploy_to_ghcr_custom_tag.yaml #1

name: Build, push Docker image and deploy to Azure
on:
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
packages: write
jobs:
push_to_ghcr:
runs-on: ubuntu-latest
steps:
- name: Checkout GitHub Action
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
run: |
GITHUB_REPO="${GITHUB_REPO,,}" # convert repo name to lowercase as required by docker
echo "building docker image in repository '$GITHUB_REPO' ..."
docker build --label "org.opencontainers.image.title=copilot-metrics-viewer" --label "org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage" --label "org.opencontainers.image.source=$GITHUB_REPO" -t ghcr.io/$GITHUB_REPO:latest .
docker push ghcr.io/$GITHUB_REPO:latest
env:
GITHUB_REPO: ${{ github.repository }}
deploy:
runs-on: ubuntu-latest
needs: push_to_ghcr
environment:
name: 'production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'copilot-metrics-viewer'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_e94dfd38811a421eafe5ce4eee13b68b }}
images: 'ghcr.io/github-copilot-resources/copilot-metrics-viewer:latest'