2021-01-17 16:20:18 +00:00
|
|
|
name: deployment
|
2021-01-17 11:59:37 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-02-03 14:47:15 +00:00
|
|
|
branches:
|
|
|
|
- master
|
2021-01-17 11:59:37 +00:00
|
|
|
tags:
|
|
|
|
- v*
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
create_release:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
2022-02-03 14:47:15 +00:00
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
2021-01-17 11:59:37 +00:00
|
|
|
steps:
|
|
|
|
- name: Create release
|
|
|
|
id: create_release
|
|
|
|
uses: actions/create-release@v1
|
|
|
|
env:
|
2022-02-03 14:47:15 +00:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-01-17 11:59:37 +00:00
|
|
|
with:
|
2022-02-03 14:47:15 +00:00
|
|
|
tag_name: ${{ github.ref }}
|
|
|
|
release_name: ${{ github.ref }}
|
2021-01-17 11:59:37 +00:00
|
|
|
draft: false
|
|
|
|
prerelease: false
|
2022-02-03 14:47:15 +00:00
|
|
|
deploy_binaries:
|
2021-01-17 11:59:37 +00:00
|
|
|
needs: create_release
|
2022-02-03 14:47:15 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2021-01-17 11:59:37 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
os_name: linux
|
|
|
|
- os: macos-latest
|
|
|
|
os_name: macos
|
|
|
|
- os: windows-latest
|
|
|
|
os_name: windows
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
- name: Check project
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: check
|
|
|
|
- name: Build release
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --release
|
2021-05-08 20:31:35 +00:00
|
|
|
- name: Compress executable (unix)
|
2021-01-17 11:59:37 +00:00
|
|
|
if: matrix.os_name == 'linux' || matrix.os_name == 'macos'
|
2021-05-08 20:31:35 +00:00
|
|
|
run: tar czf himalaya.tar.gz -C target/release himalaya
|
|
|
|
- name: Compress executable (windows)
|
|
|
|
if: matrix.os_name == 'windows'
|
2021-01-17 11:59:37 +00:00
|
|
|
run: tar czf himalaya.tar.gz -C target/release himalaya.exe
|
|
|
|
- name: Upload release asset
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
2022-02-03 14:47:15 +00:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-01-17 11:59:37 +00:00
|
|
|
with:
|
2022-02-03 14:47:15 +00:00
|
|
|
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
2021-01-17 11:59:37 +00:00
|
|
|
asset_path: himalaya.tar.gz
|
2022-02-03 14:47:15 +00:00
|
|
|
asset_name: himalaya-${{ matrix.os_name }}.tar.gz
|
2021-01-17 11:59:37 +00:00
|
|
|
asset_content_type: application/gzip
|
2022-02-03 14:47:15 +00:00
|
|
|
deploy_crate:
|
|
|
|
needs: create_release
|
|
|
|
runs-on: linux
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
- name: Check project
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: check
|
|
|
|
- name: Publish package to crates.io
|
|
|
|
run: cargo publish
|