Skip to content

Merge pull request #176 from Organisasjonskollegiet/bug/fix-azure-dat… #164

Merge pull request #176 from Organisasjonskollegiet/bug/fix-azure-dat…

Merge pull request #176 from Organisasjonskollegiet/bug/fix-azure-dat… #164

Workflow file for this run

name: Continuous Deployment
on:
workflow_dispatch:
release:
types: [published, edited]
push:
branches:
- master
jobs:
deploy:
if: '!github.event.release.prerelease'
runs-on: ubuntu-20.04
steps:
# Setup cache and Docker action
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
# Build docker image
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
# Login
- name: Login to Docker registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
# Build and push docker container
- name: Build and push Image to Github Container Registry
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.docker_meta.outputs.tags }},ghcr.io/organisasjonskollegiet/voting-backend:${{ github.sha }} # Add the SHA as a tag
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
build-args: |
${{ secrets.BUILD_ARGS }}
- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: vaas
images: 'ghcr.io/organisasjonskollegiet/voting-backend:${{ github.sha }}'
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}