-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (77 loc) · 2.86 KB
/
Copy pathrelease.yml
File metadata and controls
92 lines (77 loc) · 2.86 KB
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
name: Build and Release
on:
release:
types: [ created ]
workflow_dispatch:
inputs:
tag:
description: 'Release tag to upload assets to (e.g. v1.0.0)'
required: true
permissions:
contents: write
jobs:
build:
name: Build for ${{ matrix.asset_name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
artifact_name: linkora-proxy
asset_name: linkora-proxy-linux-amd64
use_cross: false
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
artifact_name: linkora-proxy
asset_name: linkora-proxy-linux-arm64
use_cross: true
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: linkora-proxy.exe
asset_name: linkora-proxy-windows-amd64.exe
use_cross: false
- os: windows-latest
target: aarch64-pc-windows-msvc
artifact_name: linkora-proxy.exe
asset_name: linkora-proxy-windows-arm64.exe
use_cross: false
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: linkora-proxy
asset_name: linkora-proxy-macos-amd64
use_cross: false
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: linkora-proxy
asset_name: linkora-proxy-macos-arm64
use_cross: false
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install musl-tools
if: matrix.os == 'ubuntu-latest' && matrix.use_cross == false
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Install cross
if: matrix.use_cross == true
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build (cross)
if: matrix.use_cross == true
run: cross build --release --target ${{ matrix.target }}
- name: Build
if: matrix.use_cross == false
run: cargo build --release --target ${{ matrix.target }}
- name: Rename Artifact Linux and Mac
if: matrix.os != 'windows-latest'
run: mv target/${{ matrix.target }}/release/${{ matrix.artifact_name }} ./${{ matrix.asset_name }}
- name: Move Artifact Windows
if: matrix.os == 'windows-latest'
run: Move-Item -Path target\${{ matrix.target }}\release\${{ matrix.artifact_name }} -Destination ./${{ matrix.asset_name }}
- name: Upload to Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
files: ./${{ matrix.asset_name }}