From 609b58b18f23317a235235b57bfbc6505de2f060 Mon Sep 17 00:00:00 2001 From: Luis Felipe Dominguez Vega Date: Thu, 6 Aug 2020 00:52:02 -0400 Subject: [PATCH] Add release support to CI --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 57 +++++++++++++++++++++++++++++++++++ .github/workflows/rust.yml | 20 ------------ 3 files changed, 58 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 891ba14..d1d8f46 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,4 +45,4 @@ jobs: - uses: actions-rs/cargo@v1 with: command: clippy - args: -- -D clippy::all -D clippy::pedantic -D warnings + args: -- -D clippy::all -D warnings diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7c5997b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,57 @@ +name: Build and upload binaries to release + +on: + push: + tags: ["v*"] + +jobs: + create_release: + runs-on: ubuntu-latest + 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 + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + upload_assets: + needs: create_release + strategy: + matrix: + include: + - os: ubuntu-latest + artifact_name: rustyping + asset_name: rustyping-linux-x64.tar.gz + - os: macos-latest + artifact_name: rustyping + asset_name: rustyping-darwin-x64.tar.gz + runs-on: ${{ matrix.os }} + steps: + - name: checkout the source code + uses: actions/checkout@v2 + - name: build (release) + run: cargo build --verbose --release + - name: compress + uses: master-atul/tar-action@v1.0.2 + with: + command: c + cwd: ./target/release + files: | + ${{ matrix.artifact_name }} + outPath: ./target/release/${{ matrix.asset_name }} + - name: upload release assets + id: upload-release-assets + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ./target/release/${{ matrix.asset_name }} + asset_name: ${{ matrix.asset_name }} + asset_content_type: application/tar+gzip diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index f78f92d..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Rust - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Build - run: cargo build --release --verbose