himalaya/.github/workflows/deployment.yaml
2021-05-08 22:32:50 +02:00

67 lines
1.8 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
build:
needs: create_release
runs-on: ${{matrix.os}}
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
- name: Compress executable (unix)
if: matrix.os_name == 'linux' || matrix.os_name == 'macos'
run: tar czf himalaya.tar.gz -C target/release himalaya
- name: Compress executable (windows)
if: matrix.os_name == 'windows'
run: tar czf himalaya.tar.gz -C target/release himalaya.exe
- 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