Merge pull request #1173 from academic-relations/dev #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: AR-002 Main Push Demo | |
permissions: | |
contents: read | |
packages: write | |
on: | |
push: | |
branches: ["main"] | |
workflow_call: | |
secrets: | |
DEMO_WEBHOOK_ENDPOINT: | |
description: "The webhook endpoint to trigger the demo workflow" | |
required: true | |
jobs: | |
publish-docker-image: | |
name: "Build and Publish Latest Docker Image" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- dockerfile: ./.docker/dockerfile/web.Dockerfile | |
image: ghcr.io/academic-relations/ar-002-clubs-demo-web | |
- dockerfile: ./.docker/dockerfile/api.Dockerfile | |
image: ghcr.io/academic-relations/ar-002-clubs-demo-api | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: "Log in to Github Container Registry" | |
uses: docker/login-action@v2 | |
with: | |
registry: "ghcr.io" | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Extract Metadata" | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ matrix.image }} | |
labels: latest | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ${{ matrix.dockerfile }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
deploy-production-image: | |
name: "Deploy Latest Staging Docker Image to Server" | |
needs: [publish-docker-image] | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Image push via webhook" | |
uses: distributhor/workflow-webhook@v3 | |
with: | |
webhook_url: ${{ secrets.DEMO_WEBHOOK_ENDPOINT }} | |