Skip to content

Fix ruby version

Fix ruby version #21

name: Build and deploy a container to an Azure Web App
env:
AZURE_WEBAPP_NAME: rifiel-railsapp # set this to the name of your Azure Web App
on:
push:
branches: [ "main" ]
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_SERVER }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_SECRET }}
- name: Lowercase the repo name and username
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
- name: Build and push container image to registry
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ secrets.REGISTRY_SERVER }}/${{ env.REPO }}:${{ github.sha }}
file: ./Dockerfile
deploy:
permissions:
contents: none
runs-on: ubuntu-latest
needs: build
environment:
name: 'Development'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Lowercase the repo name and username
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
- name: 'Login via Azure CLI'
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
images: '${{ secrets.REGISTRY_SERVER }}/${{ env.REPO }}:${{ github.sha }}'