From 49423f07e7e5d31aade2fe518e103f5f85125f2d Mon Sep 17 00:00:00 2001 From: figsoda Date: Mon, 2 Nov 2020 19:01:46 -0500 Subject: [PATCH] create release github action --- .github/workflows/release.yml | 75 +++++++++++++++++++++++++++++++++++ 1 file changed, 75 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..4282e87 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,75 @@ +name: release + +on: + push: + tags: + - v[0-9]+.[0-9]+.[0-9]+ + +jobs: + create_release: + name: create_release + runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + steps: + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + tag_name: ${{ github.ref }} + release_name: mmtc ${{ github.ref }} + body: "[Changelog](https://github.com/figsoda/mmtc/blob/main/CHANGELOG.md)" + draft: false + prerelease: false + + release: + name: release + needs: create_release + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - target: x86_64-apple-darwin + os: macos-latest + - target: x86_64-pc-windows-gnu + os: windows-latest + ext: .exe + - target: x86_64-pc-windows-msvc + os: windows-latest + ext: .exe + - target: x86_64-unknown-linux-gnu + os: ubuntu-latest + - target: x86_64-unknown-linux-musl + os: ubuntu-latest + use-cross: true + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install rust toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + target: ${{ matrix.target }} + override: true + + - name: Cargo build + uses: actions-rs/cargo@v1 + with: + use-cross: ${{ matrix.use-cross }} + command: build + args: --release --target ${{ matrix.target }} + + - name: Upload release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ./target/${{ matrix.target }}/release/mmtc${{ matrix.ext }} + asset_name: mmtc-${{ matrix.target }}${{ matrix.ext }} + asset_content_type: application/octet-stream