0.3.0-rc1 - 2024-09-13 #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | | |
mkdir kaspa-ng-${{ github.event.release.tag_name }}-windows-x64 || true | |
cargo build --bin kaspa-ng --release | |
cp target/release/kaspa-ng.exe kaspa-ng-${{ github.event.release.tag_name }}-windows-x64/ | |
cargo build --bin kaspa-ng --profile console --features console | |
cp target/release/kaspa-ng.exe kaspa-ng-${{ github.event.release.tag_name }}-windows-x64/kaspa-ng-console.exe | |
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 | |