-
Notifications
You must be signed in to change notification settings - Fork 16
137 lines (122 loc) · 5.54 KB
/
deploy.yaml
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Build and upload assets
on:
release:
types: [ published ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Build gnu-linux on ubuntu-18.04 and musl on ubuntu latest
# os: [ ubuntu-18.04, ubuntu-latest, windows-latest, macos-latest ]
os: [ ubuntu-latest, windows-latest, macos-latest ]
name: Building, ${{ matrix.os }}
steps:
- name: Fix CRLF on Windows
if: runner.os == 'Windows'
run: git config --global core.autocrlf false
- name: Install desktop dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt install -y libglib2.0-dev libatk1.0-dev libgtk-3-dev librust-atk-dev
- name: Checkout sources
uses: actions/checkout@v3
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install zig on linux
if: runner.os == 'Linux'
uses: goto-bus-stop/setup-zig@v2 # needed for cargo-zigbuild
- name: Build on Windows
if: runner.os == 'Windows'
shell: bash
run: |
cargo build --bin kaspa-ng --release
mkdir kaspa-ng-${{ github.event.release.tag_name }}-windows-x64 || true
cp target/release/kaspa-ng.exe kaspa-ng-${{ github.event.release.tag_name }}-windows-x64/
archive="kaspa-ng-${{ github.event.release.tag_name }}-windows-x64/kaspa-ng-${{ github.event.release.tag_name }}-windows-x64.zip"
asset_name="kaspa-ng-${{ github.event.release.tag_name }}-windows-x64.zip"
powershell "Compress-Archive kaspa-ng-${{ github.event.release.tag_name }}-windows-x64/* \"${archive}\""
echo "asset_path=${archive}" >> $GITHUB_ENV
echo "asset_name=${asset_name}" >> $GITHUB_ENV
- name: Build on MacOS
if: runner.os == 'macOS'
run: |
cargo build --bin kaspa-ng --release
mkdir kaspa-ng-${{ github.event.release.tag_name }}-macos-arm64 || true
cp target/release/kaspa-ng kaspa-ng-${{ github.event.release.tag_name }}-macos-arm64/
archive="kaspa-ng-${{ github.event.release.tag_name }}-macos-arm64/kaspa-ng-${{ github.event.release.tag_name }}-macos-arm64.zip"
asset_name="kaspa-ng-${{ github.event.release.tag_name }}-macos-arm64.zip"
zip -r "${archive}" ./kaspa-ng-${{ github.event.release.tag_name }}-macos-arm64/*
echo "asset_path=${archive}" >> $GITHUB_ENV
echo "asset_name=${asset_name}" >> $GITHUB_ENV
- name: Build on Linux
if: runner.os == 'Linux'
run: |
cargo build --bin kaspa-ng --release
mkdir -p .debpkg/usr/bin
cp target/release/kaspa-ng .debpkg/usr/bin/
mkdir kaspa-ng-${{ github.event.release.tag_name }}-linux-gnu-amd64 || true
cp target/release/kaspa-ng kaspa-ng-${{ github.event.release.tag_name }}-linux-gnu-amd64/
archive="kaspa-ng-${{ github.event.release.tag_name }}-linux-gnu-amd64/kaspa-ng-${{ github.event.release.tag_name }}-linux-gnu-amd64.zip"
asset_name="kaspa-ng-${{ github.event.release.tag_name }}-linux-gnu-amd64.zip"
zip -r "${archive}" ./kaspa-ng-${{ github.event.release.tag_name }}-linux-gnu-amd64/*
echo "archive=${archive}" >> $GITHUB_ENV
echo "asset_name=${asset_name}" >> $GITHUB_ENV
- name: Create Linux Debian Package
if: runner.os == 'Linux'
id: package_debian
uses: jiro4989/build-deb-action@v3
with:
package: kaspa-ng
package_root: .debpkg
maintainer: ASPECTRON
version: ${{ github.ref }} # refs/tags/v*.*.*
arch: 'amd64'
depends: 'libglib2.0-0, libatk1.0-0, libgtk-3-0'
desc: 'Kaspa NG desktop p2p node and wallet'
- name: Upload release asset
if: runner.os == 'Windows'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: "./${{ env.asset_path }}"
asset_name: "${{ env.asset_name }}"
asset_content_type: application/zip
- name: Upload release asset
if: runner.os == 'macOS'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: "./${{ env.asset_path }}"
asset_name: "${{ env.asset_name }}"
asset_content_type: application/zip
- name: Upload debian package
if: runner.os == 'Linux'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: "./${{ steps.package_debian.outputs.file_name }}"
asset_name: "${{ steps.package_debian.outputs.file_name }}"
asset_content_type: application/vnd.debian.binary-package