-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1afc3eb
commit a429f8f
Showing
1 changed file
with
26 additions
and
19 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,35 @@ | ||
name: CI | ||
|
||
on: | ||
# Triggers the workflow on push or pull request events but only for the "main" branch | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
# 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 | ||
- name: Install Nix | ||
uses: cachix/install-nix-action@v25 | ||
with: | ||
name: nammayatri | ||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | ||
skipPush: true | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
|
||
- 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 | ||
- name: Build all flake outputs | ||
run: om ci | ||
echo "Pushed image: $FULL_IMAGE_NAME" |