Skip to content

πŸ’š ci: fix build #9

πŸ’š ci: fix build

πŸ’š ci: fix build #9

# Deployed to https://staging.api.fairhub.io
name: (staging) Build and push docker image to Azure Container Registry
on:
push:
branches:
- staging
pull_request:
types: [closed]
branches:
- staging
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build and push Docker image
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
runs-on: ubuntu-latest
env:
AZURE_REGISTRY_LOGIN_SERVER: ${{ secrets.AZURE_REGISTRY_LOGIN_SERVER }}
AZURE_REGISTRY_USERNAME: ${{ secrets.AZURE_REGISTRY_USERNAME }}
AZURE_REGISTRY_PASSWORD: ${{ secrets.AZURE_REGISTRY_PASSWORD }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to Azure Container Registry
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.AZURE_REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.AZURE_REGISTRY_USERNAME }}
password: ${{ secrets.AZURE_REGISTRY_PASSWORD }}
- name: Get GitHub short SHA
id: git_sha
run: echo ::set-output name=sha::$(git rev-parse --short ${{ github.sha }})
- name: create .env file
run: |
echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> .env
echo "SUPABASE_URL=${{ secrets.SUPABASE_URL }}" >> .env
echo "SUPABASE_KEY=${{ secrets.SUPABASE_KEY }}" >> .env
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.AZURE_REGISTRY_LOGIN_SERVER }}/fairhub-portal:staging,${{ secrets.AZURE_REGISTRY_LOGIN_SERVER }}/fairhub-portal:${{ steps.git_sha.outputs.sha }}