Skip to content

Commit

Permalink
add release workflow (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
yourmoonlight authored Jun 26, 2023
1 parent e20712c commit ed45096
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/release_asset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Release asset bot

on:
workflow_dispatch:
release:
types: [published]
jobs:
build:
name: Build release asset
continue-on-error: true
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
- ubuntu-18.04
- ubuntu-22.04
- macos-latest
- windows-latest
runs-on: ${{matrix.platform}}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install LLVM and Clang # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797
uses: KyleMayes/install-llvm-action@v1
if: matrix.platform == 'windows-latest'
with:
version: "11.0"
directory: ${{ runner.temp }}/llvm
- name: Set LIBCLANG_PATH
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
if: matrix.platform == 'windows-latest'
- name: build for ${{ matrix.platform }}
uses: actions-rs/cargo@v1
with:
command: build
args: --release

- name: build rooch release asset
run: bash ./scripts/release.sh ${{ matrix.platform }}

- name: upload artifact asset
uses: actions/upload-artifact@v2
if: ${{ github.event_name != 'release'}}
with:
name: rooch-${{ matrix.platform }}.zip
path: ./rooch-${{ matrix.platform }}.zip

- name: upload rooch release asset
if: ${{ github.event_name == 'release'}}
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./rooch-${{ matrix.platform }}.zip
asset_name: rooch-${{ matrix.platform }}.zip
asset_content_type: application/zip
10 changes: 10 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
rm -rf rooch-artifacts/*
mkdir -p rooch-artifacts/
cp -v target/release/rooch rooch-artifacts/
cp -v README.md rooch-artifacts/
if [ "$1" == "windows-latest" ]; then
7z a -r rooch-$1.zip rooch-artifacts
else
zip -r rooch-$1.zip rooch-artifacts
fi

0 comments on commit ed45096

Please sign in to comment.