-
-
Notifications
You must be signed in to change notification settings - Fork 2
108 lines (104 loc) · 3.87 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Release
on:
push:
tags:
- '*'
defaults:
run:
shell: bash
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
jobs:
native:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
artifact_name: jira_cli
asset_name: jira_cli-linux_amd64
- os: macos-latest
rust: stable
target: x86_64-apple-darwin
artifact_name: jira_cli
asset_name: jira_cli-darwin_amd64
steps:
- uses: Swatinem/rust-cache@v2
with:
shared-key: jira_cli-${{ matrix.target }}
cache-on-failure: true
- uses: actions/checkout@v4
- run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
name: Update Rustup and define default toolchain
- run: rustup target add ${{ matrix.target }}
name: Add target
- run: sudo apt update -y && sudo apt install expect gcc-multilib libjemalloc-dev libsecret-1-0 libsecret-1-dev -y
name: Install dependencies for Linux
if: matrix.os == 'ubuntu-latest'
- run: rustup component add rustfmt || echo "rustfmt not available"
name: Install rustfmt
- run: cargo build --release --target ${{ matrix.target }}
name: Build
env:
RUSTFLAGS: "-C target-feature=+crt-static"
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
tag: ${{ github.ref_name }}
cross:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-gnu
artifact_name: jira_cli
asset_name: jira_cli-linux_aarch64
- os: macos-latest
rust: stable
target: aarch64-apple-darwin
artifact_name: jira_cli
asset_name: jira_cli-darwin_arm
steps:
- uses: Swatinem/rust-cache@v2
with:
shared-key: jira_cli-${{ matrix.target }}
cache-on-failure: true
- uses: actions/checkout@v4
- run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
name: Update Rustup and define default toolchain
- run: rustup target add ${{ matrix.target }}
name: Add target
- run: sudo apt update -y && sudo apt install expect g++-aarch64-linux-gnu gcc-aarch64-linux-gnu libjemalloc-dev libsecret-1-0 libsecret-1-dev -y
name: Install dependencies for Linux
if: matrix.os == 'ubuntu-latest'
- run: rustup component add rustfmt || echo "rustfmt not available"
name: Install rustfmt
- run: cargo build --release --target ${{ matrix.target }}
name: Build for all architecture except Mac ARM
env:
RUSTFLAGS: "-C target-feature=+crt-static"
if: matrix.target != 'aarch64-apple-darwin'
- run: |
SDKROOT=$(xcrun -sdk macosx --show-sdk-path)
MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)
cargo build --release --target ${{ matrix.target }}
name: Build for Mac ARM
env:
RUSTFLAGS: "-C target-feature=+crt-static"
if: matrix.target == 'aarch64-apple-darwin'
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
tag: ${{ github.ref_name }}