Skip to content

Commit 7910a77

Browse files
committed
Setup CI to create linux binaries and make releases
1 parent bc5c471 commit 7910a77

File tree

1 file changed

+68
-7
lines changed

1 file changed

+68
-7
lines changed

.github/workflows/release.yml

Lines changed: 68 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,83 @@
1-
name: "Publish Docker"
1+
name: "Release"
22
on:
3+
# workflow_dispatch:
34
push:
45
tags:
56
- '*' # Push events to every tag
67

78
jobs:
8-
publish:
9+
build-linux-binaries:
10+
strategy:
11+
matrix:
12+
include:
13+
- os: linux
14+
arch: '386'
15+
- os: linux
16+
arch: 'amd64'
17+
- os: linux
18+
arch: 'arm'
19+
extraArgs: "-cc arm-linux-gnueabi-gcc"
20+
- os: linux
21+
arch: 'arm64'
22+
extraArgs: "-cc aarch64-linux-gnu-gcc"
923
runs-on: ubuntu-latest
1024
steps:
11-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v4
1226
- name: Set up Go
13-
uses: actions/setup-go@v2
27+
uses: actions/setup-go@v5
1428
with:
1529
go-version: 1.21.4
1630

31+
- name: install gcc
32+
run: sudo apt-get update && sudo apt-get install gcc-multilib
33+
34+
- name: setup gcc
35+
if: matrix.arch == 'arm'
36+
run: sudo apt-get install gcc-arm-linux-gnueabi
37+
38+
- name: setup gcc
39+
if: matrix.arch == 'arm64'
40+
run: sudo apt-get install gcc-aarch64-linux-gnu
41+
42+
- name: Build
43+
run: GOOS=${{ matrix.os }} go run build/ci.go install -dlgo --arch ${{ matrix.arch }} ${{ matrix.extraArgs }}
44+
45+
- name: Prepare binary
46+
run: tar -czvf subquery-geth-${{ matrix.os }}-${{ matrix.arch }}-${{ github.ref_name }}.tar.gz ./build/bin/geth
47+
48+
# TODO SHA-256
49+
50+
- name: Archive binary
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: subquery-geth-${{ matrix.os }}-${{ matrix.arch }}-${{ github.ref_name }}.tar.gz
54+
path: subquery-geth-${{ matrix.os }}-${{ matrix.arch }}-${{ github.ref_name }}.tar.gz
55+
56+
release:
57+
runs-on: ubuntu-latest
58+
needs: build-linux-binaries
59+
steps:
60+
61+
- name: Download all binaries
62+
uses: actions/download-artifact@v4
63+
with:
64+
path: artifacts
65+
66+
- name: Inspect artifacts
67+
run: ls -R artifacts
68+
69+
- name: Release
70+
uses: softprops/action-gh-release@v1
71+
if: startsWith(github.ref, 'refs/tags/')
72+
with:
73+
files: artifacts/**/*.tar.gz
74+
75+
## This is working
76+
publish-docker:
77+
runs-on: ubuntu-latest
78+
steps:
79+
- uses: actions/checkout@v4
80+
1781
- name: Set up QEMU
1882
uses: docker/setup-qemu-action@v3
1983

@@ -26,9 +90,6 @@ jobs:
2690
username: subquerynetwork
2791
password: ${{ secrets.SQ_DOCKERHUB_TOKEN }}
2892

29-
- name: Build Docker
30-
run: go run build/ci.go docker -image -manifest amd64,arm64 -upload subquerynetwork/geth
31-
3293
- name: Build and push
3394
uses: docker/build-push-action@v5
3495
with:

0 commit comments

Comments
 (0)