mirror of
https://github.com/soywod/himalaya.git
synced 2024-11-21 18:40:19 +00:00
improve release process
This commit is contained in:
parent
ce2b292d2b
commit
12e71a5ba8
3 changed files with 81 additions and 68 deletions
65
.github/workflows/release.yml
vendored
65
.github/workflows/release.yml
vendored
|
@ -6,13 +6,13 @@ on:
|
||||||
- v*
|
- v*
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
create_release:
|
create-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create-release.outputs.upload_url }}
|
||||||
steps:
|
steps:
|
||||||
- name: Create release
|
- name: Create release
|
||||||
id: create_release
|
id: create-release
|
||||||
uses: actions/create-release@v1
|
uses: actions/create-release@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
@ -22,20 +22,20 @@ jobs:
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
|
|
||||||
deploy_github:
|
deploy-unix-releases:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
needs: create_release
|
needs: create-release
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- target: linux
|
- target: linux
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
|
- target: linux-musl
|
||||||
|
os: ubuntu-latest
|
||||||
- target: macos
|
- target: macos
|
||||||
os: macos-latest
|
os: macos-latest
|
||||||
- target: musl
|
# TODO: uncomment once nix build .#windows works
|
||||||
os: ubuntu-latest
|
|
||||||
# TODO: put back when nix package .#windows is fixed
|
|
||||||
# - target: windows
|
# - target: windows
|
||||||
# os: ubuntu-latest
|
# os: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -44,7 +44,7 @@ jobs:
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: cachix/install-nix-action@v24
|
uses: cachix/install-nix-action@v24
|
||||||
with:
|
with:
|
||||||
nix_path: nixpkgs=channel:nixos-23.05
|
nix_path: nixpkgs=channel:nixos-23.11
|
||||||
extra_nix_config: |
|
extra_nix_config: |
|
||||||
experimental-features = nix-command flakes
|
experimental-features = nix-command flakes
|
||||||
- uses: cachix/cachix-action@v12
|
- uses: cachix/cachix-action@v12
|
||||||
|
@ -53,16 +53,16 @@ jobs:
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||||
- name: Build release
|
- name: Build release
|
||||||
run: nix build -L .#${{ matrix.target }}
|
run: nix build -L .#${{ matrix.target }}
|
||||||
- name: Copy executable and prepare folders
|
- name: Copy binary
|
||||||
run: |
|
run: |
|
||||||
mkdir -p {man,completions}
|
|
||||||
cp result/bin/himalaya* .
|
cp result/bin/himalaya* .
|
||||||
- name: Patch interpreter
|
- name: Patch binary interpreter
|
||||||
if: ${{ matrix.target == 'linux' }}
|
if: ${{ matrix.target == 'linux' }}
|
||||||
run: |
|
run: |
|
||||||
nix-shell -p patchelf --command "sudo patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 himalaya"
|
nix-shell -p patchelf --command "sudo patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 himalaya"
|
||||||
- name: Build release archive
|
- name: Prepare release archives
|
||||||
run: |
|
run: |
|
||||||
|
mkdir -p {man,completions}
|
||||||
nix run .#${{ matrix.target }} man ./man
|
nix run .#${{ matrix.target }} man ./man
|
||||||
nix run .#${{ matrix.target }} completion bash > ./completions/himalaya.bash
|
nix run .#${{ matrix.target }} completion bash > ./completions/himalaya.bash
|
||||||
nix run .#${{ matrix.target }} completion elvish > ./completions/himalaya.elvish
|
nix run .#${{ matrix.target }} completion elvish > ./completions/himalaya.elvish
|
||||||
|
@ -71,29 +71,29 @@ jobs:
|
||||||
nix run .#${{ matrix.target }} completion zsh > ./completions/himalaya.zsh
|
nix run .#${{ matrix.target }} completion zsh > ./completions/himalaya.zsh
|
||||||
tar -czf himalaya.tgz himalaya* man completions
|
tar -czf himalaya.tgz himalaya* man completions
|
||||||
zip -r himalaya.zip himalaya* man completions
|
zip -r himalaya.zip himalaya* man completions
|
||||||
- name: Upload tar.gz release asset
|
- name: Upload tarball release archive
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
||||||
asset_path: himalaya.tgz
|
asset_path: himalaya.tgz
|
||||||
asset_name: himalaya-${{ matrix.target }}.tgz
|
asset_name: himalaya-${{ matrix.target }}.tgz
|
||||||
asset_content_type: application/gzip
|
asset_content_type: application/gzip
|
||||||
- name: Upload zip release asset
|
- name: Upload zip release archive
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
||||||
asset_path: himalaya.zip
|
asset_path: himalaya.zip
|
||||||
asset_name: himalaya-${{ matrix.target }}.zip
|
asset_name: himalaya-${{ matrix.target }}.zip
|
||||||
asset_content_type: application/zip
|
asset_content_type: application/zip
|
||||||
|
|
||||||
# TODO: remove me when nix package .#windows is fixed
|
# TODO: remove me once nix build .#windows works
|
||||||
deploy_windows_github:
|
deploy-windows-release:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
needs: create_release
|
needs: create-release
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -101,16 +101,19 @@ jobs:
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
- name: Builds release
|
profile: minimal
|
||||||
|
- name: Build release
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: build
|
command: build
|
||||||
args: --release
|
args: --release
|
||||||
- name: Compress executable
|
- name: Copy binary
|
||||||
|
run: |
|
||||||
|
copy target/release/himalaya.exe .
|
||||||
|
- name: Prepare release archives
|
||||||
run: |
|
run: |
|
||||||
mkdir man
|
mkdir man
|
||||||
mkdir completions
|
mkdir completions
|
||||||
copy target/release/himalaya.exe .
|
|
||||||
./himalaya.exe man ./man
|
./himalaya.exe man ./man
|
||||||
./himalaya.exe completion bash > ./completions/himalaya.bash
|
./himalaya.exe completion bash > ./completions/himalaya.bash
|
||||||
./himalaya.exe completion elvish > ./completions/himalaya.elvish
|
./himalaya.exe completion elvish > ./completions/himalaya.elvish
|
||||||
|
@ -119,35 +122,35 @@ jobs:
|
||||||
./himalaya.exe completion zsh > ./completions/himalaya.zsh
|
./himalaya.exe completion zsh > ./completions/himalaya.zsh
|
||||||
tar -czf himalaya.tgz himalaya.exe man completions
|
tar -czf himalaya.tgz himalaya.exe man completions
|
||||||
Compress-Archive -Path himalaya.exe,man,completions -DestinationPath himalaya.zip
|
Compress-Archive -Path himalaya.exe,man,completions -DestinationPath himalaya.zip
|
||||||
- name: Upload tar.gz release asset
|
- name: Upload tarball release archive
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
||||||
asset_path: himalaya.tgz
|
asset_path: himalaya.tgz
|
||||||
asset_name: himalaya-windows.tgz
|
asset_name: himalaya-windows.tgz
|
||||||
asset_content_type: application/gzip
|
asset_content_type: application/gzip
|
||||||
- name: Upload zip release asset
|
- name: Upload zip release archive
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
||||||
asset_path: himalaya.zip
|
asset_path: himalaya.zip
|
||||||
asset_name: himalaya-windows.zip
|
asset_name: himalaya-windows.zip
|
||||||
asset_content_type: application/zip
|
asset_content_type: application/zip
|
||||||
|
|
||||||
deploy_crates:
|
publish-crates-io:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: create_release
|
needs: create-release
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: cachix/install-nix-action@v24
|
uses: cachix/install-nix-action@v24
|
||||||
with:
|
with:
|
||||||
nix_path: nixpkgs=channel:nixos-23.05
|
nix_path: nixpkgs=channel:nixos-23.11
|
||||||
extra_nix_config: |
|
extra_nix_config: |
|
||||||
experimental-features = nix-command flakes
|
experimental-features = nix-command flakes
|
||||||
- name: Publish library to crates.io
|
- name: Publish library to crates.io
|
||||||
|
|
20
flake.lock
20
flake.lock
|
@ -8,11 +8,11 @@
|
||||||
"rust-analyzer-src": "rust-analyzer-src"
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1704003651,
|
"lastModified": 1704090261,
|
||||||
"narHash": "sha256-bA3d4E1CX5G7TVbKwJOm9jZfVOGOPp6u5CKEUzNsE8E=",
|
"narHash": "sha256-Vti1mv4WhmXHPNcFgUiJyt4OKLvsvLzM2eKS4bEegf0=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "fenix",
|
"repo": "fenix",
|
||||||
"rev": "c6d82e087ac96f24b90c5787a17e29a72566c2b4",
|
"rev": "66fc1883c34c42df188b83272445aedb26bb64b5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -97,16 +97,16 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1703351344,
|
"lastModified": 1703992652,
|
||||||
"narHash": "sha256-9FEelzftkE9UaJ5nqxidaJJPEhe9TPhbypLHmc2Mysc=",
|
"narHash": "sha256-C0o8AUyu8xYgJ36kOxJfXIroy9if/G6aJbNOpA5W0+M=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "7790e078f8979a9fcd543f9a47427eeaba38f268",
|
"rev": "32f63574c85fbc80e4ba1fbb932cde9619bad25e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"ref": "nixos-23.05",
|
"ref": "nixos-23.11",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
@ -124,11 +124,11 @@
|
||||||
"rust-analyzer-src": {
|
"rust-analyzer-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1703965384,
|
"lastModified": 1704034202,
|
||||||
"narHash": "sha256-3iyouqkBvhh/E48TkBlt4JmmcIEyfQwY7pokKBx9WNg=",
|
"narHash": "sha256-OFBXLWm+aIqG+jNAz8BmB+QpepI11SGLtSY6qEs6EmY=",
|
||||||
"owner": "rust-lang",
|
"owner": "rust-lang",
|
||||||
"repo": "rust-analyzer",
|
"repo": "rust-analyzer",
|
||||||
"rev": "e872f5085cf5b0e44558442365c1c033d486eff2",
|
"rev": "cf52c4b2b3367ae7355ef23393e2eae1d37de723",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
64
flake.nix
64
flake.nix
|
@ -2,7 +2,7 @@
|
||||||
description = "CLI to manage emails";
|
description = "CLI to manage emails";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
gitignore = {
|
gitignore = {
|
||||||
url = "github:hercules-ci/gitignore.nix";
|
url = "github:hercules-ci/gitignore.nix";
|
||||||
|
@ -35,7 +35,9 @@
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
nativeBuildInputs = with pkgs; [ pkg-config ];
|
nativeBuildInputs = with pkgs; [
|
||||||
|
pkg-config
|
||||||
|
];
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
# Nix
|
# Nix
|
||||||
rnix-lsp
|
rnix-lsp
|
||||||
|
@ -83,22 +85,27 @@
|
||||||
mkPackages = buildPlatform:
|
mkPackages = buildPlatform:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { system = buildPlatform; };
|
pkgs = import nixpkgs { system = buildPlatform; };
|
||||||
mkPackageWithTarget = mkPackage pkgs buildPlatform;
|
mkPackage' = mkPackage pkgs buildPlatform;
|
||||||
defaultPackage = mkPackage pkgs buildPlatform null { };
|
|
||||||
in
|
in
|
||||||
{
|
rec {
|
||||||
default = defaultPackage;
|
default = if pkgs.stdenv.isDarwin then macos else linux;
|
||||||
linux = defaultPackage;
|
linux = mkPackage' null { };
|
||||||
macos = defaultPackage;
|
linux-musl = mkPackage' "x86_64-unknown-linux-musl" (with pkgs.pkgsStatic; {
|
||||||
musl = mkPackageWithTarget "x86_64-unknown-linux-musl" (with pkgs.pkgsStatic; {
|
|
||||||
CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static";
|
CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static";
|
||||||
SQLITE3_STATIC = 1;
|
SQLITE3_STATIC = 1;
|
||||||
SQLITE3_LIB_DIR = "${sqlite.out}/lib";
|
SQLITE3_LIB_DIR = "${sqlite.out}/lib";
|
||||||
hardeningDisable = [ "all" ];
|
hardeningDisable = [ "all" ];
|
||||||
});
|
});
|
||||||
|
macos = mkPackage' null (with pkgs.darwin.apple_sdk.frameworks; {
|
||||||
|
# NOTE: needed to prevent error Undefined symbols
|
||||||
|
# "_OBJC_CLASS_$_NSImage" and
|
||||||
|
# "_LSCopyApplicationURLsForBundleIdentifier"
|
||||||
|
NIX_LDFLAGS = "-F${AppKit}/Library/Frameworks -framework AppKit";
|
||||||
|
buildInputs = [ Cocoa ];
|
||||||
|
});
|
||||||
# FIXME: bzlip: fatal error: windows.h: No such file or directory
|
# FIXME: bzlip: fatal error: windows.h: No such file or directory
|
||||||
# May be related to SQLite.
|
# May be related to SQLite.
|
||||||
windows = mkPackageWithTarget "x86_64-pc-windows-gnu" {
|
windows = mkPackage' "x86_64-pc-windows-gnu" {
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
depsBuildBuild = with pkgs.pkgsCross.mingwW64; [
|
depsBuildBuild = with pkgs.pkgsCross.mingwW64; [
|
||||||
stdenv.cc
|
stdenv.cc
|
||||||
|
@ -112,23 +119,26 @@
|
||||||
name = "himalaya";
|
name = "himalaya";
|
||||||
};
|
};
|
||||||
|
|
||||||
mkApps = buildPlatform: {
|
mkApps = buildPlatform:
|
||||||
default = mkApp self.packages.${buildPlatform}.default;
|
let
|
||||||
linux = mkApp self.packages.${buildPlatform}.linux;
|
pkgs = import nixpkgs { system = buildPlatform; };
|
||||||
macos = mkApp self.packages.${buildPlatform}.macos;
|
in
|
||||||
musl = mkApp self.packages.${buildPlatform}.musl;
|
rec {
|
||||||
windows =
|
default = if pkgs.stdenv.isDarwin then macos else linux;
|
||||||
let
|
linux = mkApp self.packages.${buildPlatform}.linux;
|
||||||
pkgs = import nixpkgs { system = buildPlatform; };
|
linux-musl = mkApp self.packages.${buildPlatform}.linux-musl;
|
||||||
wine = pkgs.wine.override { wineBuild = "wine64"; };
|
macos = mkApp self.packages.${buildPlatform}.macos;
|
||||||
himalaya = self.packages.${buildPlatform}.windows;
|
windows =
|
||||||
app = pkgs.writeShellScriptBin "himalaya" ''
|
let
|
||||||
export WINEPREFIX="$(mktemp -d)"
|
wine = pkgs.wine.override { wineBuild = "wine64"; };
|
||||||
${wine}/bin/wine64 ${himalaya}/bin/himalaya.exe $@
|
himalaya = self.packages.${buildPlatform}.windows;
|
||||||
'';
|
app = pkgs.writeShellScriptBin "himalaya" ''
|
||||||
in
|
export WINEPREFIX="$(mktemp -d)"
|
||||||
mkApp app;
|
${wine}/bin/wine64 ${himalaya}/bin/himalaya.exe $@
|
||||||
};
|
'';
|
||||||
|
in
|
||||||
|
mkApp app;
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
flake-utils.lib.eachDefaultSystem (system: {
|
flake-utils.lib.eachDefaultSystem (system: {
|
||||||
|
|
Loading…
Reference in a new issue