Skip to content

Merge pull request #308 from rohaizanr:fix-saas-publish #30

Merge pull request #308 from rohaizanr:fix-saas-publish

Merge pull request #308 from rohaizanr:fix-saas-publish #30

Workflow file for this run

name: Publish API to Docker Hub
on:
push:
branches:
- main
# Listen on all paths under the "api" directory except for api/core
paths:
- "api/**"
jobs:
build-public-web:
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Verify Docker Hub credentials
run: |
if [[ -z "${{ secrets.DOCKER_USERNAME }}" || -z "${{ secrets.DOCKER_PASSWORD }}" ]]; then
echo "Error: Missing Docker Hub credentials";
exit 1;
fi
- name: Log in to Docker Hub
run: |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build and publish to Docker Hub
run: |
VERSION=$(git rev-parse HEAD) # Use short commit hash for versioning
IMAGE_NAME=dev4w4n/emasjid-public-web:${VERSION}
docker build -t emasjid-public-web ./public-web
docker tag emasjid-public-web $IMAGE_NAME
docker push $IMAGE_NAME