Skip to content

Commit

Permalink
backend/enh/docker-push-for-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
vsaimanohar authored and srid committed Sep 23, 2024
1 parent 1afc3eb commit 5ef3d86
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 57 deletions.
40 changes: 33 additions & 7 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,54 @@
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

outputs:
image_name: ${{ steps.image_info.outputs.image_name }}
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: Docker tasks
if: github.ref == 'refs/heads/main'
run: |
nix build .#dockerImage -o docker-image.tgz
echo "image_name=$(nix eval --raw .#dockerImage.imageName):$(nix eval --raw .#dockerImage.imageTag)" >> $GITHUB_OUTPUT
- name: Upload Docker image tarball
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: docker-image
path: docker-image.tgz

push-docker:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Download Docker image tarball
uses: actions/download-artifact@v4
with:
name: docker-image
- name: Load and push Docker image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "$GITHUB_TOKEN" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
docker load < docker-image.tgz
docker push ${{ needs.build.outputs.image_name }}
docker logout ghcr.io
50 changes: 0 additions & 50 deletions Jenkinsfile

This file was deleted.

0 comments on commit 5ef3d86

Please sign in to comment.