2021-05-01 21:56:12 +00:00
|
|
|
name: release
|
2021-05-01 21:49:22 +00:00
|
|
|
on:
|
|
|
|
push:
|
2021-10-29 18:31:25 +00:00
|
|
|
branches: [main]
|
2021-10-15 02:57:28 +00:00
|
|
|
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
|
2021-10-29 18:31:25 +00:00
|
|
|
pull_request:
|
|
|
|
workflow_dispatch:
|
|
|
|
|
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
|
|
|
|
- os: ubuntu-latest
|
|
|
|
target: arm-unknown-linux-musleabihf
|
|
|
|
- os: ubuntu-latest
|
|
|
|
target: armv7-unknown-linux-musleabihf
|
|
|
|
- os: ubuntu-latest
|
|
|
|
target: aarch64-unknown-linux-musl
|
|
|
|
|
|
|
|
- os: macos-11
|
|
|
|
target: x86_64-apple-darwin
|
|
|
|
- os: macos-11
|
|
|
|
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
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
2021-10-29 18:31:25 +00:00
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set artifact name
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
version="$(git describe --tags --match='v*.*.*' --always)"
|
|
|
|
name="zoxide-$version-${{ matrix.target }}"
|
|
|
|
echo "ARTIFACT_NAME=$name" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
echo "version: $version"
|
|
|
|
echo "artifact: $name"
|
|
|
|
|
2021-05-01 21:49:22 +00:00
|
|
|
- name: Install Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
target: ${{ matrix.target }}
|
2021-10-29 18:31:25 +00:00
|
|
|
|
2021-05-01 21:49:22 +00:00
|
|
|
- name: Build binary
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
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' }}
|
|
|
|
|
|
|
|
- name: Package (*nix)
|
|
|
|
if: runner.os != 'Windows'
|
|
|
|
run: >
|
|
|
|
tar -cv
|
|
|
|
CHANGELOG.md LICENSE README.md
|
|
|
|
man/
|
|
|
|
-C contrib/ completions/ -C ../
|
|
|
|
-C target/${{ matrix.target }}/release/ zoxide
|
|
|
|
| gzip --best > '${{ env.ARTIFACT_NAME }}.tar.gz'
|
|
|
|
- name: Package (Windows)
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
run: >
|
|
|
|
7z a ${{ env.ARTIFACT_NAME }}.zip
|
|
|
|
CHANGELOG.md LICENSE README.md
|
|
|
|
./man/
|
|
|
|
./contrib/completions/
|
|
|
|
./target/${{ matrix.target }}/release/zoxide.exe
|
|
|
|
|
|
|
|
- name: Upload artifact
|
2021-05-01 21:49:22 +00:00
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2021-10-29 18:31:25 +00:00
|
|
|
name: ${{ matrix.target }}
|
|
|
|
path: |
|
|
|
|
*.zip
|
|
|
|
*.tar.gz
|
|
|
|
|
2021-05-01 21:49:22 +00:00
|
|
|
- name: Create release
|
2021-10-29 18:31:25 +00:00
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
2021-05-01 21:49:22 +00:00
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
|
|
|
draft: true
|
2021-10-29 18:31:25 +00:00
|
|
|
files: |
|
|
|
|
*.zip
|
|
|
|
*.tar.gz
|