-
Notifications
You must be signed in to change notification settings - Fork 1
141 lines (122 loc) · 4.35 KB
/
release.yml
File metadata and controls
141 lines (122 loc) · 4.35 KB
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
138
139
140
141
name: Release
on:
release:
types: [created]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest-xl
target: x86_64-unknown-linux-gnu
artifact_name: bitcell-linux-x86_64
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: bitcell-macos-x86_64
- os: macos-14 # Native ARM64 runner
target: aarch64-apple-darwin
artifact_name: bitcell-macos-aarch64
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: bitcell-windows-x86_64
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libfontconfig1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev
- name: Build release binaries
run: cargo build --release --target ${{ matrix.target }} -p bitcell-node -p bitcell-admin -p bitcell-wallet -p bitcell-wallet-gui
- name: Create artifact directory
shell: bash
run: mkdir -p artifacts
- name: Copy binaries (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
cp target/${{ matrix.target }}/release/bitcell-node artifacts/
cp target/${{ matrix.target }}/release/bitcell-admin artifacts/
cp target/${{ matrix.target }}/release/bitcell-wallet artifacts/
cp target/${{ matrix.target }}/release/bitcell-wallet-gui artifacts/
- name: Copy binaries (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
cp target/${{ matrix.target }}/release/bitcell-node.exe artifacts/
cp target/${{ matrix.target }}/release/bitcell-admin.exe artifacts/
cp target/${{ matrix.target }}/release/bitcell-wallet.exe artifacts/
cp target/${{ matrix.target }}/release/bitcell-wallet-gui.exe artifacts/
- name: Create archive (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
cd artifacts
tar -czvf ../${{ matrix.artifact_name }}.tar.gz *
cd ..
- name: Create archive (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Compress-Archive -Path artifacts/* -DestinationPath ${{ matrix.artifact_name }}.zip
- name: Upload artifact (Unix)
if: runner.os != 'Windows'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_name }}.tar.gz
retention-days: 7
- name: Upload artifact (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_name }}.zip
retention-days: 7
release:
name: Upload Release Assets
needs: build
runs-on: ubuntu-latest-xl
if: github.event_name == 'release'
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display structure of downloaded files
run: ls -la artifacts/
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/bitcell-linux-x86_64/bitcell-linux-x86_64.tar.gz
artifacts/bitcell-macos-x86_64/bitcell-macos-x86_64.tar.gz
artifacts/bitcell-macos-aarch64/bitcell-macos-aarch64.tar.gz
artifacts/bitcell-windows-x86_64/bitcell-windows-x86_64.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}