mirror of https://github.com/Trivernis/nenv
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.7 KiB
YAML
70 lines
1.7 KiB
YAML
name: "Build and Release"
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
create-release-draft:
|
|
name: pre-release
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
outputs:
|
|
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
if: ${{ !env.ACT }}
|
|
|
|
- id: create_release
|
|
uses: ncipollo/release-action@v1
|
|
if: ${{ !env.ACT }}
|
|
with:
|
|
draft: true
|
|
artifacts: |
|
|
LICENSE
|
|
|
|
build-release:
|
|
needs: create-release-draft
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
permissions:
|
|
contents: write
|
|
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
|
|
target/release/nenv.exe
|
|
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 |