Skip to content

Revert "test"

Revert "test" #41

name: Build and Publish Docker Image
on:
release:
types:
- published
- edited
push:
branches:
- FixBuildAndPublishImage
jobs:
build-and-publish-release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get Tag Name
id: get_tag_name
run: |
version=$(echo $GITHUB_REF | sed 's/refs\/tags\///' | sed 's/.*_//')
echo "version=${version}" >> ${GITHUB_OUTPUT}
# BACKEND
- name: Build Docker Image
run: docker build -t seed-test-backend:${{ steps.get_tag_name.outputs.version }} ./backend
- name: Tag Docker Image as Latest
run: |
docker tag seed-test-backend:${{ steps.get_tag_name.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/seed-test-backend:${{ steps.get_tag_name.outputs.version }}
docker tag seed-test-backend:${{ steps.get_tag_name.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/seed-test-backend:latest
- name: Push Docker Image to Docker Hub
run: |
docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-backend:${{ steps.get_tag_name.outputs.version }}
- name: Push Docker Image to Docker Hub as latest
if: ${{ startsWith(github.event.release.name, 'Seed-Test_v') }}
run: docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-backend:latest
# FRONTEND
- name: Build Docker Image
run: docker build -t seed-test-frontend:${{ steps.get_tag_name.outputs.version }} ./frontend
- name: Tag Docker Image as Latest
run: |
docker tag seed-test-frontend:${{ steps.get_tag_name.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/seed-test-frontend:${{ steps.get_tag_name.outputs.version }}
docker tag seed-test-frontend:${{ steps.get_tag_name.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/seed-test-frontend:latest
- name: Push Docker Image to Docker Hub
run: |
docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-frontend:${{ steps.get_tag_name.outputs.version }}
- name: Push Docker Image to Docker Hub as latest
if: ${{ startsWith(github.event.release.name, 'Seed-Test_v') }}
run: docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-frontend:latest
# SINGLE QUICK DEMO CONTAINER
- name: Build Docker Image as Latest
run: |
docker build -t seed-test-demo:${{ steps.get_tag_name.outputs.version }} .
- name: Tag Docker Image as Latest
run: |
docker tag seed-test-demo:${{ steps.get_tag_name.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/seed-test-demo:${{ steps.get_tag_name.outputs.version }}
docker tag seed-test-demo:${{ steps.get_tag_name.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/seed-test-demo:latest
- name: Push Docker Image to Docker Hub
run: |
docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-demo:${{ steps.get_tag_name.outputs.version }}
- name: Push Docker Image to Docker Hub as latest
if: ${{ startsWith(github.event.release.name, 'Seed-Test_v') }}
run: docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-demo:latest
- name: Post success message
uses: ./actions/notifyTeams
with:
title: "Publish Release DockerHub 🐳🌐"
text: "Publishing Images for release ${{ github.event.release.name }} successfully."
style: "success"
webhook: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
- name: Post error message
if: ${{ failure() }}
uses: ./actions/notifyTeams
with:
title: "Publish Release DockerHub 🐳🌐❌"
text: "Publishing Images for release ${{ github.event.release.name }} failed."
style: "failure"
webhook: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}