Release asset bot #180
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: Release asset bot | |
on: | |
workflow_dispatch: | |
release: | |
types: [published] | |
jobs: | |
build-on-github: | |
name: Build release asset | |
continue-on-error: true | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- ubuntu-latest | |
- ubuntu-20.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: Install LLVM and Clang for Ubuntu22.04 | |
uses: egor-tensin/setup-clang@v1 | |
if: matrix.platform == 'ubuntu-22.04' | |
with: | |
platform: x64 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
version: '3.x' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: build for ${{ matrix.platform }} | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: cd ./cmd/starcoin && cargo build --release | |
- name: build starcoin 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: starcoin-${{ matrix.platform }}.zip | |
path: ./starcoin-${{ matrix.platform }}.zip | |
- name: upload starcoin 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: ./starcoin-${{ matrix.platform }}.zip | |
asset_name: starcoin-${{ matrix.platform }}.zip | |
asset_content_type: application/zip | |
- name: upload mpm release asset | |
if: ${{ github.event_name == 'release'}} | |
id: upload-mpm-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./mpm-${{ matrix.platform }}.zip | |
asset_name: mpm-${{ matrix.platform }}.zip | |
asset_content_type: application/zip | |
build-on-selfhosted: | |
name: Build release asset with selfhosted | |
runs-on: self-hosted | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
version: '3.x' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: build for ubuntu-18.04 | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release | |
- name: build starcoin release asset | |
run: bash ./scripts/release.sh 'ubuntu-18.04' | |
- name: build mpm release asset | |
run: bash ./scripts/release_mpm.sh 'ubuntu-18.04' | |
- name: upload artifact asset | |
uses: actions/upload-artifact@v2 | |
if: ${{ github.event_name != 'release'}} | |
with: | |
name: starcoin-ubuntu-18.04.zip | |
path: ./starcoin-ubuntu-18.04.zip | |
- name: upload starcoin 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: ./starcoin-ubuntu-18.04.zip | |
asset_name: starcoin-ubuntu-18.04.zip | |
asset_content_type: application/zip | |
- name: upload mpm release asset | |
if: ${{ github.event_name == 'release'}} | |
id: upload-mpm-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./mpm-ubuntu-18.04.zip | |
asset_name: mpm-ubuntu-18.04.zip | |
asset_content_type: application/zip |