Skip to content

backend/enh/docker-push-for-ci #18

backend/enh/docker-push-for-ci

backend/enh/docker-push-for-ci #18

Workflow file for this run

name: CI
on:
push:
branches: ["*"]
pull_request:
branches: ["*"]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and push Docker image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Build and load Docker image
docker load -i $(nix build .#dockerImage --no-link --print-out-paths)
# Set image name and tag
IMAGE_NAME="ghcr.io/nammayatri/beckn-gateway"
IMAGE_TAG="${GITHUB_SHA::7}"
FULL_IMAGE_NAME="${IMAGE_NAME}:${IMAGE_TAG}"
# Login to GitHub Container Registry
echo "$GITHUB_TOKEN" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
# Tag and push the image
docker tag "ghcr.io/nammayatri/beckn-gateway:a7c614" "$FULL_IMAGE_NAME"
docker push "$FULL_IMAGE_NAME"
# Logout
docker logout ghcr.io
echo "Pushed image: $FULL_IMAGE_NAME"