Skip to content

Commit

Permalink
[CI] Polish release (#1)
Browse files Browse the repository at this point in the history
Signed-off-by: lloydmeta <lloydmeta@gmail.com>
  • Loading branch information
lloydmeta authored Dec 12, 2020
1 parent e2af581 commit ab482ee
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 37 deletions.
71 changes: 35 additions & 36 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,48 @@

name: Build Binaries
on:
release:
types: # This configuration does not affect the page_build event above
- created
push:

jobs:
build_for_mac:
name: MacOS
runs-on: macos-10.15
build:
name: For [${{ matrix.os }} ${{ matrix.target }}]
strategy:
fail-fast: false
matrix:
include:
- os: macos-10.15
target: x86_64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
- uses: actions-rs/cargo@v1

- name: Install musl-tools
if: contains(matrix.target, 'musl')
run: sudo apt-get install musl-tools

- uses: actions-rs/toolchain@v1
with:
command: build
args: --release
- name: Rename binary
run: mv target/release/jhhi jhhi-macos64
- name: Upload to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl \
-f \
-sSL \
-XPOST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Length: $(stat -f%z jhhi-macos64)" \
-H "Content-Type: application/octet-stream" \
--upload-file "jhhi-macos64" \
"https://uploads.github.com/repos/$GITHUB_REPOSITORY/releases/$(jq --raw-output '.release.id' $GITHUB_EVENT_PATH)/assets?name=jhhi-macos64"
build_for_linux:
name: Linux
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
toolchain: stable
target: ${{ matrix.target }}
override: true

- uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Rename binary
run: mv target/release/jhhi jhhi-linux-amd64
args: --release --target ${{ matrix.target }}

- name: Strip the binary
run: strip target/${{ matrix.target }}/release/jhhi

- name: Tar the binary
run: tar -czvf jhhi-${{ matrix.target }}.tar.gz target/${{ matrix.target }}/release/jhhi

- name: Upload to release
uses: JasonEtco/upload-to-release@d648f1babf776de9cad881320bd9e9818fc3b262
with:
args: jhhi-linux-amd64 application/octet-stream
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: jhhi-${{ matrix.target }}.tar.gz
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ tokio = { version = "0.2", features = ["fs", "macros", "rt-threaded"] }
jheap_histo = { path = "jheap_histo", version = "0.1.0" }
structopt = "0.3"
anyhow = "1.0"
elasticsearch = "7.10.0-alpha.1"
elasticsearch = { version = "7.10.0-alpha.1", default-features = false, features = ["rustls-tls"] }
serde = "1"
serde_json = "1"
chrono = { version = "0.4", features = ["serde"] }
Expand Down

0 comments on commit ab482ee

Please sign in to comment.