Merge pull request #49 from academic-relations/46-impl-apiprp001-getp… #19
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-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 }} | |