Skip to content

prepare v0.1.0

prepare v0.1.0 #2

Workflow file for this run

name: release
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:
runs-on: ${{ matrix.os }}
needs: create_release
strategy:
fail-fast: false
matrix:
include:
- target: linux
os: ubuntu-latest
- target: macos
os: macos-latest
- target: windows
os: ubuntu-latest
- target: musl
os: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Nix
uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
experimental-features = nix-command flakes
- uses: cachix/cachix-action@v12
with:
name: soywod
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build release
run: nix build .#${{ matrix.target }}
- name: Compress executable
run: |
mkdir -p {man,completions}
cp result/bin/mml* .
nix run .#${{ matrix.target }} man ./man
nix run .#${{ matrix.target }} completion bash > ./completions/mml.bash
nix run .#${{ matrix.target }} completion elvish > ./completions/mml.elvish
nix run .#${{ matrix.target }} completion fish > ./completions/mml.fish
nix run .#${{ matrix.target }} completion powershell > ./completions/mml.powershell
nix run .#${{ matrix.target }} completion zsh > ./completions/mml.zsh
tar -czf mml.tar.gz mml* man completions
zip -r mml.zip mml* man completions
- name: Upload tar.gz 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: mml.tar.gz
asset_name: mml-${{ matrix.target }}.tar.gz
asset_content_type: application/gzip
- name: Upload zip 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: mml.zip
asset_name: mml-${{ matrix.target }}.zip
asset_content_type: application/zip
deploy_crates:
runs-on: ubuntu-latest
needs: create_release
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Nix
uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
experimental-features = nix-command flakes
- name: Publish library to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: nix develop -c cargo publish --no-verify --token ${CARGO_REGISTRY_TOKEN}