Skip to content

Commit

Permalink
ci: add release on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
BugenZhao committed Dec 10, 2020
1 parent ef8233a commit 3aa1acc
Showing 1 changed file with 17 additions and 24 deletions.
41 changes: 17 additions & 24 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ on:
jobs:
main:
name: Release
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
TARGET: x86_64-apple-darwin
- os: ubuntu-latest
TARGET: x86_64-unknown-linux-gnu

steps:
- name: Checkout sources
uses: actions/checkout@v2
Expand All @@ -20,40 +28,25 @@ jobs:
toolchain: stable
override: true

- name: Run cargo test
- name: Run cargo build
uses: actions-rs/cargo@v1
with:
command: test
command: build
args: --release

- name: Run cargo build
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: build
command: test
args: --release

- name: Zip
run: |
zip -j flashroute_rs_linux_amd64 ./target/release/flashroute_rs
zip -j flashroute_rs_${{ matrix.TARGET }} ./target/release/flashroute_rs
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
files: ./flashroute_rs_${{ matrix.TARGET }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./flashroute_rs_linux_amd64.zip
asset_name: flashroute_rs_linux_amd64.zip
asset_content_type: application/zip

0 comments on commit 3aa1acc

Please sign in to comment.