-
Notifications
You must be signed in to change notification settings - Fork 662
105 lines (94 loc) · 2.99 KB
/
release.yml
File metadata and controls
105 lines (94 loc) · 2.99 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
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Release
on:
push:
tags:
- 'v*'
env:
CARGO_TERM_COLOR: always
jobs:
create-release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
build-release:
needs: create-release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Linux
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: edit
asset_name: edit-x86_64-linux.tar.gz
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
artifact_name: edit
asset_name: edit-x86_64-linux-musl.tar.gz
# macOS
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: edit
asset_name: edit-x86_64-macos.tar.gz
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: edit
asset_name: edit-aarch64-macos.tar.gz
# Windows
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: edit.exe
asset_name: edit-x86_64-windows.zip
- os: windows-latest
target: aarch64-pc-windows-msvc
artifact_name: edit.exe
asset_name: edit-aarch64-windows.zip
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Install cross-compilation tools
if: matrix.target == 'x86_64-unknown-linux-musl'
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
- name: Create archive (Unix)
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
tar -czf ../../../${{ matrix.asset_name }} ${{ matrix.artifact_name }}
- name: Create archive (Windows)
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
7z a ../../../${{ matrix.asset_name }} ${{ matrix.artifact_name }}
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./${{ matrix.asset_name }}
asset_name: ${{ matrix.asset_name }}
asset_content_type: application/octet-stream