Skip to content

Improve auto-installing TypeScript types #23

Improve auto-installing TypeScript types

Improve auto-installing TypeScript types #23

Workflow file for this run

name: Release
on:
push:
tags: ["v*"]
# on PRs only build and test. Does not upload artifacts anywhere.
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
output: ny
archive: tar.gz
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
output: ny
archive: tar.gz
- target: x86_64-apple-darwin
os: macos-latest
output: ny
archive: zip
- target: aarch64-apple-darwin
os: macos-latest
output: ny
archive: zip
steps:
- uses: actions/checkout@v2
- uses: FranzDiebold/github-env-vars-action@v2.3.1
- name: Install coreutils for macOS
if: matrix.os == 'macos-latest'
run: brew install coreutils
# Cache files between builds
- name: Setup | Cache Cargo
uses: actions/cache@v2.1.7
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Setup | Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
target: ${{ matrix.target }}
override: true
- name: Build release
uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.target }} --release
use-cross: ${{ matrix.os == 'ubuntu-latest' }}
- name: Copy and rename utility
run: cp target/${{ matrix.target }}/release/${{ matrix.output }} ${{ matrix.output }}
- name: Create archive (linux)
if: ${{ matrix.os != 'macos-latest' && matrix.os != 'windows-latest' }}
run: |
tar -czvf ny-${{ matrix.target }}.${{ matrix.archive }} ${{ matrix.output }}
sha256sum ny-${{ matrix.target }}.${{ matrix.archive }} > ny-${{ matrix.target }}-sha256sum.txt
# - name: Create archive (windows)
# if: ${{ matrix.os == 'windows-latest' }}
# run: |
# tar.exe -a -c -f ny-${{ matrix.target }}.${{ matrix.archive }} ${{ matrix.output }}
# sha256sum.exe ny-${{ matrix.target }}.${{ matrix.archive }} > ny-${{ matrix.target }}-sha256sum.txt
- name: Create archive (macos)
if: ${{ matrix.os == 'macos-latest' }}
run: |
zip ny-${{ matrix.target }}.${{ matrix.archive }} ${{ matrix.output }}
sha256sum ny-${{ matrix.target }}.${{ matrix.archive }} > ny-${{ matrix.target }}-sha256sum.txt
- name: Upload artifacts archive
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: actions/upload-artifact@v2
with:
name: ny-${{ matrix.target }}.${{ matrix.archive }}
path: ny-${{ matrix.target }}.${{ matrix.archive }}
- name: Upload artifacts checksum
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: actions/upload-artifact@v2
with:
name: ny-${{ matrix.target }}-sha256sum.txt
path: ny-${{ matrix.target }}-sha256sum.txt
- name: Upload binary to release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ny-${{ matrix.target }}.${{ matrix.archive }}
asset_name: ny-${{ matrix.target }}.${{ matrix.archive }}
tag: ${{ github.ref }}
overwrite: true
- name: Upload checksum to release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ny-${{ matrix.target }}-sha256sum.txt
asset_name: ny-${{ matrix.target }}-sha256sum.txt
tag: ${{ github.ref }}
overwrite: true