From 5881d8bce5380aba729abc44b3423daaab39e922 Mon Sep 17 00:00:00 2001 From: Aten Date: Tue, 22 Jun 2021 17:20:08 +0800 Subject: [PATCH] [Feature]generate release in CI (#81) * release ci init * add more * support for macos * fix error * support for win * support llvm * add path * add dependencies * test windows * test windows * fmt * test * test llvm-config * test path * . * to 11 * recover * fix * add path * fix * test link * new * test llvm * update new version * workflow for windows * test tag name * tip * fix * test url * use gitref * tag name * add tag * fix all problem * add name --- .github/workflows/release.yml | 141 ++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7ca5eb7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,141 @@ +name: Release + +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - "v*" # Any tag will cause release + +env: + CARGO_TERM_COLOR: always + +jobs: + create_release: + name: Create release + runs-on: ubuntu-latest + # Note this. We are going to use that in further jobs. + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + tag: ${{ steps.get_tag.outputs.tag }} + steps: + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + - name: Get Tag + id: get_tag + uses: olegtarasov/get-tag@v2.1 + + echo-tag: + name: Echo Tag + needs: create_release + runs-on: ubuntu-latest + steps: + - name: Echo Tag + run: | + echo europa-${{ needs.create_release.outputs.tag }} + echo url:${{ needs.create_release.outputs.upload_url }} + + release-linux: + name: Release on Ubuntu + needs: create_release # we need to know the upload URL + runs-on: ubuntu-latest + steps: + - name: Set stable toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + - name: Checkout source + uses: actions/checkout@v1 + - name: Init + run: git submodule update --init --remote + + - name: Build + run: cargo build --release + + - name: Upload linux Release + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ./target/release/europa + asset_name: europa-${{ needs.create_release.outputs.tag }}-x86_64-ubuntu + asset_content_type: application/octet-stream + + build-mac: + name: Release on macOS + needs: create_release # we need to know the upload URL + runs-on: macos-latest + + steps: + - name: Set stable toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: x86_64-apple-darwin + override: true + + - name: Checkout source + uses: actions/checkout@v1 + - name: Init + run: git submodule update --init --remote + - name: Build + run: cargo build --release + + - name: Upload macOS Release + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ./target/release/europa + asset_name: europa-${{ needs.create_release.outputs.tag }}-x86_64-apple-darwin + asset_content_type: application/octet-stream + + build-win: + name: Release on win + needs: create_release # we need to know the upload URL + runs-on: windows-latest + + steps: + - name: Set stable toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + - name: Checkout source + uses: actions/checkout@v1 + - name: Init + run: git submodule update --init --remote + + - name: Set LLVM Config + uses: engineerd/configurator@v0.0.8 + with: + name: "llvm-config.exe" + url: "https://github.com/taichi-dev/taichi_assets/releases/download/llvm10/taichi-llvm-10.0.0-msvc2019.zip" + pathInArchive: "bin/llvm-config.exe" + - name: Set LLVM + run: echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + - name: Build + run: cargo build --release + + - name: Upload win Release + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: .\target\release\europa.exe + asset_name: europa-${{ needs.create_release.outputs.tag }}-x86_64-win.exe + asset_content_type: application/octet-stream