From 2b4f80b14190b5550d11ce7a54aca812bc794821 Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Wed, 15 Apr 2020 16:36:40 +0200 Subject: [PATCH] Add linux release step --- .github/workflows/cd.yml | 37 ++++++++++++++++++++++++++++++------- .github/workflows/ci.yml | 5 ++++- Makefile | 13 +++++++++---- 3 files changed, 43 insertions(+), 12 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 3c934fbe..e32bc79f 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -6,8 +6,12 @@ on: - '*' jobs: - release-osx: - runs-on: macos-latest + release: + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + rust: [stable] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - name: Get version @@ -19,13 +23,19 @@ jobs: run: make test - name: Run clippy run: make clippy - - name: Build Release - run: make build-release + + - name: Build Release Mac + if: matrix.os == 'macos-latest' + run: make release-mac + - name: Build Release Linux + if: matrix.os == 'ubuntu-latest' + run: make release-linux - name: Set SHA + if: matrix.os == 'macos-latest' id: shasum run: | - echo ::set-output name=sha::"$(shasum -a 256 ./target/gitui-mac.tar.gz | awk '{printf $1}')" + echo ::set-output name=sha::"$(shasum -a 256 ./release/gitui-mac.tar.gz | awk '{printf $1}')" - name: Create Release id: create_release @@ -39,16 +49,29 @@ jobs: prerelease: true - name: Upload Release Asset + if: matrix.os == 'macos-latest' uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: ./target/gitui-mac.tar.gz + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./release/gitui-mac.tar.gz asset_name: gitui-mac.tar.gz asset_content_type: application/gzip + + - name: Upload Release Asset + if: matrix.os == 'ubuntu-latest' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./release/gitui-linux.tar.gz + asset_name: gitui-linux.tar.gz + asset_content_type: application/gzip - name: Bump Brew + if: matrix.os == 'macos-latest' env: HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.BREW_TOKEN }} run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 854a7af3..711d2275 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,17 +13,20 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] + rust: [stable] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - - name: Build + - name: Build Debug run: cargo build - name: Run tests run: make test - name: Run clippy run: make clippy + - name: Build Release + run: make build-release - name: Security audit uses: actions-rs/audit-check@v1 with: diff --git a/Makefile b/Makefile index 6dbae493..8463c84c 100644 --- a/Makefile +++ b/Makefile @@ -6,11 +6,16 @@ debug: build-release: cargo build --release + +release-mac: build-release strip target/release/gitui - ls -lisah target/release/gitui - tar -C ./target/release/ -czvf ./target/gitui-mac.tar.gz ./gitui - ls -lisah ./target/gitui-mac.tar.gz - shasum -a 256 ./target/gitui-mac.tar.gz | awk '{printf $1}' + mkdir -p release + tar -C ./target/release/ -czvf ./release/gitui-mac.tar.gz ./gitui + +release-linux: build-release + strip target/release/gitui + mkdir -p release + tar -C ./target/release/ -czvf ./release/gitui-linux.tar.gz ./gitui test: cargo test --workspace