2023-04-30 22:19:59 +00:00
|
|
|
name: release
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- v*
|
|
|
|
|
|
|
|
jobs:
|
2024-01-01 15:22:30 +00:00
|
|
|
create-release:
|
2023-04-30 22:19:59 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
2024-01-01 15:22:30 +00:00
|
|
|
upload_url: ${{ steps.create-release.outputs.upload_url }}
|
2023-04-30 22:19:59 +00:00
|
|
|
steps:
|
|
|
|
- name: Create release
|
2024-01-01 15:22:30 +00:00
|
|
|
id: create-release
|
2023-04-30 22:19:59 +00:00
|
|
|
uses: actions/create-release@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
tag_name: ${{ github.ref }}
|
|
|
|
release_name: ${{ github.ref }}
|
|
|
|
draft: false
|
|
|
|
prerelease: false
|
|
|
|
|
2024-01-01 15:22:30 +00:00
|
|
|
deploy-unix-releases:
|
2023-04-30 22:19:59 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2024-01-01 15:22:30 +00:00
|
|
|
needs: create-release
|
2023-04-30 22:19:59 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- target: linux
|
|
|
|
os: ubuntu-latest
|
2024-01-01 15:22:30 +00:00
|
|
|
- target: linux-musl
|
|
|
|
os: ubuntu-latest
|
2023-04-30 22:19:59 +00:00
|
|
|
- target: macos
|
|
|
|
os: macos-latest
|
2024-01-01 15:22:30 +00:00
|
|
|
# TODO: uncomment once nix build .#windows works
|
2023-04-30 22:19:59 +00:00
|
|
|
# - target: windows
|
|
|
|
# os: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install Nix
|
2023-12-31 23:27:45 +00:00
|
|
|
uses: cachix/install-nix-action@v24
|
2023-04-30 22:19:59 +00:00
|
|
|
with:
|
2024-01-01 15:22:30 +00:00
|
|
|
nix_path: nixpkgs=channel:nixos-23.11
|
2023-04-30 22:19:59 +00:00
|
|
|
extra_nix_config: |
|
|
|
|
experimental-features = nix-command flakes
|
|
|
|
- uses: cachix/cachix-action@v12
|
|
|
|
with:
|
|
|
|
name: soywod
|
|
|
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
|
|
- name: Build release
|
2023-12-31 23:27:45 +00:00
|
|
|
run: nix build -L .#${{ matrix.target }}
|
2024-01-01 15:22:30 +00:00
|
|
|
- name: Copy binary
|
2023-04-30 22:19:59 +00:00
|
|
|
run: |
|
|
|
|
cp result/bin/himalaya* .
|
2024-01-01 15:22:30 +00:00
|
|
|
- name: Patch binary interpreter
|
2023-12-31 23:27:45 +00:00
|
|
|
if: ${{ matrix.target == 'linux' }}
|
|
|
|
run: |
|
|
|
|
nix-shell -p patchelf --command "sudo patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 himalaya"
|
2024-01-01 15:22:30 +00:00
|
|
|
- name: Prepare release archives
|
2023-12-31 23:27:45 +00:00
|
|
|
run: |
|
2024-01-01 15:22:30 +00:00
|
|
|
mkdir -p {man,completions}
|
2023-04-30 22:19:59 +00:00
|
|
|
nix run .#${{ matrix.target }} man ./man
|
|
|
|
nix run .#${{ matrix.target }} completion bash > ./completions/himalaya.bash
|
|
|
|
nix run .#${{ matrix.target }} completion elvish > ./completions/himalaya.elvish
|
|
|
|
nix run .#${{ matrix.target }} completion fish > ./completions/himalaya.fish
|
|
|
|
nix run .#${{ matrix.target }} completion powershell > ./completions/himalaya.powershell
|
|
|
|
nix run .#${{ matrix.target }} completion zsh > ./completions/himalaya.zsh
|
2023-05-01 09:41:39 +00:00
|
|
|
tar -czf himalaya.tgz himalaya* man completions
|
2023-04-30 22:19:59 +00:00
|
|
|
zip -r himalaya.zip himalaya* man completions
|
2024-01-01 15:22:30 +00:00
|
|
|
- name: Upload tarball release archive
|
2023-04-30 22:19:59 +00:00
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
2024-01-01 15:22:30 +00:00
|
|
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
2023-05-01 09:41:39 +00:00
|
|
|
asset_path: himalaya.tgz
|
|
|
|
asset_name: himalaya-${{ matrix.target }}.tgz
|
2023-04-30 22:19:59 +00:00
|
|
|
asset_content_type: application/gzip
|
2024-01-01 15:22:30 +00:00
|
|
|
- name: Upload zip release archive
|
2023-04-30 22:19:59 +00:00
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
2024-01-01 15:22:30 +00:00
|
|
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
2023-04-30 22:19:59 +00:00
|
|
|
asset_path: himalaya.zip
|
|
|
|
asset_name: himalaya-${{ matrix.target }}.zip
|
|
|
|
asset_content_type: application/zip
|
|
|
|
|
2024-01-01 15:22:30 +00:00
|
|
|
# TODO: remove me once nix build .#windows works
|
|
|
|
deploy-windows-release:
|
2023-04-30 22:19:59 +00:00
|
|
|
runs-on: windows-latest
|
2024-01-01 15:22:30 +00:00
|
|
|
needs: create-release
|
2023-04-30 22:19:59 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
2023-04-30 22:48:28 +00:00
|
|
|
with:
|
|
|
|
toolchain: stable
|
2024-01-01 15:22:30 +00:00
|
|
|
profile: minimal
|
|
|
|
- name: Build release
|
2023-04-30 22:19:59 +00:00
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --release
|
2024-01-01 15:22:30 +00:00
|
|
|
- name: Copy binary
|
|
|
|
run: |
|
|
|
|
copy target/release/himalaya.exe .
|
|
|
|
- name: Prepare release archives
|
2023-04-30 22:19:59 +00:00
|
|
|
run: |
|
|
|
|
mkdir man
|
|
|
|
mkdir completions
|
|
|
|
./himalaya.exe man ./man
|
|
|
|
./himalaya.exe completion bash > ./completions/himalaya.bash
|
|
|
|
./himalaya.exe completion elvish > ./completions/himalaya.elvish
|
|
|
|
./himalaya.exe completion fish > ./completions/himalaya.fish
|
|
|
|
./himalaya.exe completion powershell > ./completions/himalaya.powershell
|
|
|
|
./himalaya.exe completion zsh > ./completions/himalaya.zsh
|
2023-05-01 09:41:39 +00:00
|
|
|
tar -czf himalaya.tgz himalaya.exe man completions
|
|
|
|
Compress-Archive -Path himalaya.exe,man,completions -DestinationPath himalaya.zip
|
2024-01-01 15:22:30 +00:00
|
|
|
- name: Upload tarball release archive
|
2023-04-30 22:19:59 +00:00
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
2024-01-01 15:22:30 +00:00
|
|
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
2023-05-01 09:41:39 +00:00
|
|
|
asset_path: himalaya.tgz
|
|
|
|
asset_name: himalaya-windows.tgz
|
2023-04-30 22:19:59 +00:00
|
|
|
asset_content_type: application/gzip
|
2024-01-01 15:22:30 +00:00
|
|
|
- name: Upload zip release archive
|
2023-04-30 22:19:59 +00:00
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
2024-01-01 15:22:30 +00:00
|
|
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
2023-04-30 22:19:59 +00:00
|
|
|
asset_path: himalaya.zip
|
|
|
|
asset_name: himalaya-windows.zip
|
|
|
|
asset_content_type: application/zip
|
|
|
|
|
2024-01-01 15:22:30 +00:00
|
|
|
publish-crates-io:
|
2023-04-30 22:19:59 +00:00
|
|
|
runs-on: ubuntu-latest
|
2024-01-01 15:22:30 +00:00
|
|
|
needs: create-release
|
2023-04-30 22:19:59 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2024-01-01 15:22:30 +00:00
|
|
|
uses: actions/checkout@v2
|
2023-04-30 22:19:59 +00:00
|
|
|
- name: Install Nix
|
2023-12-31 23:27:45 +00:00
|
|
|
uses: cachix/install-nix-action@v24
|
2023-04-30 22:19:59 +00:00
|
|
|
with:
|
2024-01-01 15:22:30 +00:00
|
|
|
nix_path: nixpkgs=channel:nixos-23.11
|
2023-04-30 22:19:59 +00:00
|
|
|
extra_nix_config: |
|
|
|
|
experimental-features = nix-command flakes
|
|
|
|
- name: Publish library to crates.io
|
|
|
|
env:
|
|
|
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
2023-12-31 23:27:45 +00:00
|
|
|
run: |
|
|
|
|
nix develop -c cargo publish --no-verify --token ${CARGO_REGISTRY_TOKEN}
|