2021-05-01 21:56:12 +00:00
|
|
|
name: release
|
2021-05-01 21:49:22 +00:00
|
|
|
on:
|
|
|
|
push:
|
2024-09-12 23:30:42 +00:00
|
|
|
branches: [main]
|
|
|
|
pull_request:
|
2021-10-29 18:31:25 +00:00
|
|
|
workflow_dispatch:
|
2022-04-25 09:15:46 +00:00
|
|
|
env:
|
|
|
|
CARGO_INCREMENTAL: 0
|
2023-03-18 13:52:41 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2021-05-01 21:49:22 +00:00
|
|
|
jobs:
|
2021-10-29 18:31:25 +00:00
|
|
|
release:
|
|
|
|
name: ${{ matrix.target }}
|
2021-05-01 21:49:22 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
2021-10-29 18:31:25 +00:00
|
|
|
fail-fast: false
|
2021-05-01 21:49:22 +00:00
|
|
|
matrix:
|
|
|
|
include:
|
2021-10-29 18:31:25 +00:00
|
|
|
- os: ubuntu-latest
|
|
|
|
target: x86_64-unknown-linux-musl
|
2022-06-25 19:07:44 +00:00
|
|
|
deb: true
|
2021-10-29 18:31:25 +00:00
|
|
|
- os: ubuntu-latest
|
|
|
|
target: arm-unknown-linux-musleabihf
|
|
|
|
- os: ubuntu-latest
|
|
|
|
target: armv7-unknown-linux-musleabihf
|
2024-05-29 21:18:56 +00:00
|
|
|
deb: true
|
2021-10-29 18:31:25 +00:00
|
|
|
- os: ubuntu-latest
|
|
|
|
target: aarch64-unknown-linux-musl
|
2022-06-25 19:07:44 +00:00
|
|
|
deb: true
|
2024-05-11 12:31:57 +00:00
|
|
|
- os: ubuntu-latest
|
2024-05-29 21:18:56 +00:00
|
|
|
target: i686-unknown-linux-musl
|
|
|
|
deb: true
|
|
|
|
- os: ubuntu-latest
|
2024-05-11 12:31:57 +00:00
|
|
|
target: aarch64-linux-android
|
2024-09-07 17:46:07 +00:00
|
|
|
- os: macos-latest
|
2021-10-29 18:31:25 +00:00
|
|
|
target: x86_64-apple-darwin
|
2024-09-07 17:46:07 +00:00
|
|
|
- os: macos-latest
|
2021-10-29 18:31:25 +00:00
|
|
|
target: aarch64-apple-darwin
|
|
|
|
- os: windows-latest
|
|
|
|
target: x86_64-pc-windows-msvc
|
|
|
|
- os: windows-latest
|
|
|
|
target: aarch64-pc-windows-msvc
|
2021-05-01 21:49:22 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2023-09-04 20:58:49 +00:00
|
|
|
uses: actions/checkout@v4
|
2021-05-01 21:49:22 +00:00
|
|
|
with:
|
2021-10-29 18:31:25 +00:00
|
|
|
fetch-depth: 0
|
2022-06-25 19:22:42 +00:00
|
|
|
- name: Get version
|
|
|
|
id: get_version
|
2024-02-12 21:16:41 +00:00
|
|
|
uses: SebRollen/toml-action@v1.2.0
|
2023-01-07 23:27:13 +00:00
|
|
|
with:
|
|
|
|
file: Cargo.toml
|
|
|
|
field: package.version
|
2021-05-01 21:49:22 +00:00
|
|
|
- name: Install Rust
|
2023-05-05 07:54:44 +00:00
|
|
|
uses: actions-rs/toolchain@v1
|
2021-05-01 21:49:22 +00:00
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
target: ${{ matrix.target }}
|
2022-04-25 09:15:46 +00:00
|
|
|
- name: Setup cache
|
2024-02-12 21:16:57 +00:00
|
|
|
uses: Swatinem/rust-cache@v2.7.3
|
2022-08-12 07:13:41 +00:00
|
|
|
with:
|
|
|
|
key: ${{ matrix.target }}
|
2024-05-11 12:31:57 +00:00
|
|
|
- name: Install cross
|
|
|
|
if: ${{ runner.os == 'Linux' }}
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: install
|
|
|
|
args: --color=always --git=https://github.com/cross-rs/cross.git --locked --rev=02bf930e0cb0c6f1beffece0788f3932ecb2c7eb --verbose cross
|
2021-05-01 21:49:22 +00:00
|
|
|
- name: Build binary
|
2023-05-05 07:54:44 +00:00
|
|
|
uses: actions-rs/cargo@v1
|
2021-05-01 21:49:22 +00:00
|
|
|
with:
|
|
|
|
command: build
|
2021-10-29 18:31:25 +00:00
|
|
|
args: --release --locked --target=${{ matrix.target }} --color=always --verbose
|
|
|
|
use-cross: ${{ runner.os == 'Linux' }}
|
2022-06-25 19:07:44 +00:00
|
|
|
- name: Install cargo-deb
|
|
|
|
if: ${{ matrix.deb == true }}
|
2023-05-05 07:54:44 +00:00
|
|
|
uses: actions-rs/install@v0.1
|
2022-06-25 19:07:44 +00:00
|
|
|
with:
|
2022-06-25 19:22:42 +00:00
|
|
|
crate: cargo-deb
|
2022-06-25 19:07:44 +00:00
|
|
|
- name: Build deb
|
|
|
|
if: ${{ matrix.deb == true }}
|
2023-05-05 07:54:44 +00:00
|
|
|
uses: actions-rs/cargo@v1
|
2022-06-25 19:07:44 +00:00
|
|
|
with:
|
|
|
|
command: deb
|
|
|
|
args: --no-build --no-strip --output=. --target=${{ matrix.target }}
|
2021-10-29 18:31:25 +00:00
|
|
|
- name: Package (*nix)
|
|
|
|
if: runner.os != 'Windows'
|
2023-05-06 08:39:23 +00:00
|
|
|
run: |
|
|
|
|
tar -cv CHANGELOG.md LICENSE README.md man/ \
|
|
|
|
-C contrib/ completions/ -C ../ \
|
|
|
|
-C target/${{ matrix.target }}/release/ zoxide |
|
|
|
|
gzip --best > \
|
|
|
|
zoxide-${{ steps.get_version.outputs.value }}-${{ matrix.target }}.tar.gz
|
2021-10-29 18:31:25 +00:00
|
|
|
- name: Package (Windows)
|
|
|
|
if: runner.os == 'Windows'
|
2023-05-06 08:39:23 +00:00
|
|
|
run: |
|
|
|
|
7z a zoxide-${{ steps.get_version.outputs.value }}-${{ matrix.target }}.zip `
|
|
|
|
CHANGELOG.md LICENSE README.md ./man/ ./contrib/completions/ `
|
|
|
|
./target/${{ matrix.target }}/release/zoxide.exe
|
2021-10-29 18:31:25 +00:00
|
|
|
- name: Upload artifact
|
2024-02-12 21:17:16 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2021-05-01 21:49:22 +00:00
|
|
|
with:
|
2021-10-29 18:31:25 +00:00
|
|
|
name: ${{ matrix.target }}
|
|
|
|
path: |
|
2022-06-25 19:07:44 +00:00
|
|
|
*.deb
|
2021-10-29 18:31:25 +00:00
|
|
|
*.tar.gz
|
2022-06-25 19:07:44 +00:00
|
|
|
*.zip
|
2021-05-01 21:49:22 +00:00
|
|
|
- name: Create release
|
2023-05-06 08:39:23 +00:00
|
|
|
if: |
|
2023-07-03 15:31:55 +00:00
|
|
|
github.ref == 'refs/heads/main' && startsWith(github.event.head_commit.message, 'chore(release)')
|
2024-03-13 17:30:15 +00:00
|
|
|
uses: softprops/action-gh-release@v2
|
2021-05-01 21:49:22 +00:00
|
|
|
with:
|
|
|
|
draft: true
|
2021-10-29 18:31:25 +00:00
|
|
|
files: |
|
2022-06-25 19:07:44 +00:00
|
|
|
*.deb
|
2021-10-29 18:31:25 +00:00
|
|
|
*.tar.gz
|
2022-06-25 19:07:44 +00:00
|
|
|
*.zip
|
2022-06-25 19:22:42 +00:00
|
|
|
name: ${{ steps.get_version.outputs.value }}
|
2022-06-25 19:07:44 +00:00
|
|
|
tag_name: ""
|