Skip to content

full build

full build #12

Workflow file for this run

name: Build Hasura Binary
on:
push:
tags:
- "*"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Extract Tag Version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Set CURRENT_VERSION
run: echo "$VERSION" > server/CURRENT_VERSION
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install System Dependencies
run: |
sudo apt update
sudo apt install -y gcc make musl-dev curl unixodbc-dev
- name: Setup Haskell (GHC & Cabal)
uses: haskell/actions/setup@v2
with:
ghc-version: '9.2'
cabal-version: '3.12'
- name: Cache Cabal Dependencies
uses: actions/cache@v3
with:
path: |
~/.cabal/store
dist-newstyle
server/dist-newstyle
key: ${{ runner.os }}-cabal-${{ hashFiles('cabal.project.freeze') }}
restore-keys: |
${{ runner.os }}-cabal-
- name: Install Haskell Dependencies
run: |
cabal update
cabal build all --only-dependencies
- name: Build GraphQL Engine
run: cabal build exe:graphql-engine
- name: Copy README.md to server/
run: cp README.md server/
- name: Build Executable Binary
run: |
mkdir -p artifacts
cabal install exe:graphql-engine --installdir=artifacts
mv artifacts/graphql-engine artifacts/graphql-engine-$VERSION
- name: Upload Binary Artifact
uses: actions/upload-artifact@v4
with:
name: graphql-engine
path: artifacts/graphql-engine-*
build_docker:
name: Build and Publish Docker Image
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PAT }}
- name: Download Built Binary
uses: actions/download-artifact@v4
with:
name: graphql-engine
path: artifacts/
- name: Rename and Make Binary Executable
run: |
mv artifacts/graphql-engine-* artifacts/graphql-engine
chmod +x artifacts/graphql-engine
- name: Build and Tag Docker Image
run: |
cd server
docker build -f Dockerfile -t graphql-engine:${{ github.ref_name }} .
docker tag graphql-engine:${{ github.ref_name }} qfnetwork/graphql-engine:${{ github.ref_name }}
docker tag graphql-engine:${{ github.ref_name }} qfnetwork/graphql-engine:latest
- name: Push Docker Image to Docker Hub
run: |
docker push qfnetwork/graphql-engine:${{ github.ref_name }}
docker push qfnetwork/graphql-engine:latest