Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
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
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: Build release binaries
run: cargo build --release --target ${{ matrix.target }} -p bitcell-node -p bitcell-admin

- 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/

- 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/

- 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
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 }}
Loading