mirror of
https://github.com/soywod/himalaya.git
synced 2024-11-25 20:40:24 +00:00
121 lines
4.3 KiB
YAML
121 lines
4.3 KiB
YAML
name: deployment
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- v*
|
|
|
|
jobs:
|
|
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: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
release_name: ${{ github.ref }}
|
|
draft: false
|
|
prerelease: false
|
|
deploy_linux_macos_windows_github:
|
|
runs-on: ${{ matrix.os }}
|
|
needs: create_release
|
|
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:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
- name: Check project
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
- name: Builds release
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: build
|
|
args: --release
|
|
- name: Compress executable (unix)
|
|
if: matrix.os_name == 'linux' || matrix.os_name == 'macos'
|
|
run: |
|
|
mkdir -p target/release/{man,completions}
|
|
target/release/himalaya man target/release/man
|
|
target/release/himalaya completion bash > target/release/completions/himalaya.bash
|
|
target/release/himalaya completion elvish > target/release/completions/himalaya.elvish
|
|
target/release/himalaya completion fish > target/release/completions/himalaya.fish
|
|
target/release/himalaya completion powershell > target/release/completions/himalaya.powershell
|
|
target/release/himalaya completion zsh > target/release/completions/himalaya.zsh
|
|
tar czf himalaya.tar.gz -C target/release himalaya man completions
|
|
- name: Compress executable (windows)
|
|
if: matrix.os_name == 'windows'
|
|
run: |
|
|
mkdir -p target/release/{man,completions}
|
|
target/release/himalaya.exe man target/release/man
|
|
target/release/himalaya.exe completion bash > target/release/completions/himalaya.bash
|
|
target/release/himalaya.exe completion elvish > target/release/completions/himalaya.elvish
|
|
target/release/himalaya.exe completion fish > target/release/completions/himalaya.fish
|
|
target/release/himalaya.exe completion powershell > target/release/completions/himalaya.powershell
|
|
target/release/himalaya.exe completion zsh > target/release/completions/himalaya.zsh
|
|
tar czf himalaya.tar.gz -C target/release himalaya.exe man completions
|
|
- name: Upload release asset
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
|
asset_path: himalaya.tar.gz
|
|
asset_name: himalaya-${{ matrix.os_name }}.tar.gz
|
|
asset_content_type: application/gzip
|
|
deploy_musl_github:
|
|
runs-on: ubuntu-latest
|
|
needs: create_release
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
- name: Build release
|
|
run: |
|
|
docker run -v "${PWD}:/volume" --rm -t clux/muslrust:stable cargo build --release
|
|
- name: Compress executable
|
|
run: tar czf himalaya.tar.gz -C target/x86_64-unknown-linux-musl/release himalaya
|
|
- name: Upload release asset
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
|
asset_path: himalaya.tar.gz
|
|
asset_name: himalaya-musl.tar.gz
|
|
asset_content_type: application/gzip
|
|
deploy_crates:
|
|
runs-on: ubuntu-latest
|
|
needs: create_release
|
|
environment: deployment
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
- name: Install rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
- uses: katyo/publish-crates@v1
|
|
with:
|
|
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|