backend/enh/docker-push-for-ci #22
Workflow file for this run
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: CI | |
on: | |
# Triggers the workflow on push events for all branches | |
push: | |
branches: ["*"] | |
# Triggers the workflow on pull request events for all branches | |
pull_request: | |
branches: ["*"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
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: Build and push Docker image | |
# if: github.event.pull_request.merged == true | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
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}" | |
echo "$GITHUB_TOKEN" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin | |
docker push "$FULL_IMAGE_NAME" | |
docker logout ghcr.io | |
echo "Pushed image: $FULL_IMAGE_NAME" |