Skip to content

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

backend/enh/docker-push-for-ci

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

Workflow file for this run

name: CI
on:
push:
branches: ["main"] # Only trigger on pushes to the main branch
pull_request:
branches: ["*"]
workflow_dispatch:
jobs:
build:
runs-on: x86_64-linux
steps:
- uses: actions/checkout@v4
- uses: cachix/cachix-action@v15
with:
name: nammayatri
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
skipPush: true
- name: Build all flake outputs
run: om ci
- name: Login to GitHub Container Registry
if: github.event_name == 'push' && github.event.pull_request.merged == true
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
if: github.event_name == 'push' && github.event.pull_request.merged == true
run: |
docker load -i $(nix build .#dockerImage --no-link --print-out-paths)
IMAGE_NAME="ghcr.io/nammayatri/beckn-gateway"
IMAGE_TAG="${GITHUB_SHA::6}"
FULL_IMAGE_NAME="${IMAGE_NAME}:${IMAGE_TAG}"
docker push "$FULL_IMAGE_NAME"
echo "Pushed image: $FULL_IMAGE_NAME"