forked from hasura/graphql-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (95 loc) · 3.18 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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:
needs: build
name: Build and Publish Docker Image
runs-on: [self-hosted, Linux, X64]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download Binary Artifact
uses: actions/download-artifact@v3
with:
name: graphql-engine
path: ./artifacts
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PAT }}
- name: Build and Tag Docker Image
run: |
cd docker
docker build -f Dockerfile.x86_64 -t qf-node:${{ github.ref_name }} .
docker tag qf-node:${{ github.ref_name }} qfnetwork/qf-node:${{ github.ref_name }}
docker tag qf-node:${{ github.ref_name }} qfnetwork/qf-node:latest
- name: Push Docker Image to Docker Hub (signed)
env:
DOCKER_CONTENT_TRUST: "1"
DOCKER_CONTENT_TRUST_ROOT_PASSPHRASE: ${{ secrets.DCT_ROOT_PASSPHRASE }}
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ secrets.DCT_REPO_PASSPHRASE }}
run: |
docker push qfnetwork/qf-node:${{ github.ref_name }}
docker push qfnetwork/qf-node:latest