-
Notifications
You must be signed in to change notification settings - Fork 1.1k
98 lines (83 loc) · 3.48 KB
/
build-binaries.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
name: Build Binaries and Deploy
on:
push:
branches:
- daniel/infisical-binary
tags:
- "infisical-standalone/v*.*.*"
defaults:
run:
working-directory: ./backend
jobs:
build-and-deploy:
runs-on: ubuntu-20.04
strategy:
matrix:
arch: [x64]
os: [linux]
include:
- os: linux
target: node18-linux
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Extract version from tag
id: extract_version
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/infisical-standalone/v}
else
VERSION=$(git rev-parse --short HEAD)
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install pkg
run: npm install -g @yao-pkg/pkg
- name: Install dependencies (backend)
run: npm install
- name: Install dependencies (frontend)
run: npm install --prefix ../frontend
- name: Prerequisites for pkg
run: npm run binary:build
- name: Package into node binary
run: pkg --no-bytecode --public-packages "*" --public --target ${{ matrix.target }}-${{ matrix.arch }} --output ./binary/infisical-${{ matrix.os }}-${{ matrix.arch }} .
- name: Set up .deb package structure
if: matrix.os == 'linux'
run: |
mkdir -p infisical-standalone/DEBIAN
mkdir -p infisical-standalone/usr/local/bin
cp ./binary/infisical-${{ matrix.os }}-${{ matrix.arch }} infisical-standalone/usr/local/bin/
chmod +x infisical-standalone/usr/local/bin/infisical-${{ matrix.os }}-${{ matrix.arch }}
- name: Create control file
if: matrix.os == 'linux'
run: | # Version: Is hardcoded to 3.0.0 (should be steps.extract_version.outputs.versio)
cat <<EOF > infisical-standalone/DEBIAN/control
Package: infisical-standalone
Version: 3.0.0
Section: base
Priority: optional
Architecture: ${{ matrix.arch == 'x64' && 'amd64' || matrix.arch }}
Maintainer: Infisical <daniel@infisical.com>
Description: Infisical standalone executable (app.infisical.com)
EOF
- name: Build .deb package
if: matrix.os == 'linux'
run: |
dpkg-deb --build infisical-standalone
mv infisical-standalone.deb infisical-linux-${{ matrix.arch }}.deb
- name: Upload to Cloudsmith
if: matrix.os == 'linux'
uses: cloudsmith-io/action@v0.5.0
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: "push"
format: "deb"
owner: "your-cloudsmith-org"
repo: "your-cloudsmith-repo"
distro: "any-distro"
release: "any-release"
republish: "true"
file: infisical-linux-${{ matrix.arch }}.deb