|
|
|
name: "Build and Release"
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- "v*"
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
create-release-draft:
|
|
|
|
name: pre-release
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
|
|
|
|
- id: create_release
|
|
|
|
uses: marvinpinto/action-automatic-releases@latest
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
with:
|
|
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
automatic_release_tag: latest
|
|
|
|
draft: true
|
|
|
|
title: Latest Pre-Release
|
|
|
|
files: |
|
|
|
|
LICENSE
|
|
|
|
|
|
|
|
build-release:
|
|
|
|
needs: create-release-draft
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
|
|
|
|
- name: Cache build data
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
target
|
|
|
|
~/.cargo/
|
|
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-cargo-
|
|
|
|
- name: Build
|
|
|
|
run: cargo build --release
|
|
|
|
|
|
|
|
- uses: vimtor/action-zip@v1
|
|
|
|
with:
|
|
|
|
files: target/release/nenv*
|
|
|
|
dest: nenv-${{ runner.os }}.zip
|
|
|
|
|
|
|
|
- name: Upload Release Asset
|
|
|
|
id: upload-release-asset
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ needs.create-release-draft.outputs.release_upload_url }}
|
|
|
|
asset_path: ./nenv-${{ runner.os }}.zip
|
|
|
|
asset_name: nenv-${{ runner.os }}.zip
|
|
|
|
asset_content_type: application/zip
|