Skip to content

Merge pull request #65 from academic-relations/64-impl-proposal-apis-… #25

Merge pull request #65 from academic-relations/64-impl-proposal-apis-…

Merge pull request #65 from academic-relations/64-impl-proposal-apis-… #25

Workflow file for this run

name: AR-007 Dev Push Stage
permissions:
contents: read
packages: write
on:
push:
branches: ["dev"]
workflow_call:
secrets:
STAGE_WEBHOOK_ENDPOINT:
description: "The webhook endpoint to trigger the staging 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-007-students-stage-web
- dockerfile: ./.docker/dockerfile/api.Dockerfile
image: ghcr.io/academic-relations/ar-007-students-stage-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.STAGE_WEBHOOK_ENDPOINT }}