-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (122 loc) · 3.79 KB
/
main.yml
File metadata and controls
129 lines (122 loc) · 3.79 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
on:
push:
paths-ignore:
- 'README.md'
- 'LICENSE'
- '!.github/workflows/main.yml'
jobs:
build:
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
- x86_64-pc-windows-msvc
- x86_64-apple-darwin
- aarch64-apple-darwin
include:
- target: x86_64-unknown-linux-musl
name: x86_64-linux
os: ubuntu-latest
packages: musl-tools
- target: x86_64-pc-windows-msvc
name: x86_64-windows
os: windows-latest
ext: .exe
- target: x86_64-apple-darwin
name: x86_64-apple
os: macos-latest
- target: aarch64-apple-darwin
name: aarch64-apple
os: macos-latest
bin: target/aarch64-apple-darwin/release/archiver
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- run: sudo apt-get update && sudo apt-get install -y ${{ matrix.packages }}
if: matrix.packages
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.target }}
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
env:
RUSTFLAGS: ${{ matrix.rustflags }}
- name: Upload
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}-archiver
path: target/${{ matrix.target }}/release/archiver${{ matrix.ext }}
build-macos-universal:
needs: build
runs-on: macos-latest
steps:
- uses: actions/download-artifact@v4
with:
name: x86_64-apple-archiver
path: x86_64
- uses: actions/download-artifact@v4
with:
name: aarch64-apple-archiver
path: aarch64
- name: Build
run: lipo -create -output archiver x86_64/archiver aarch64/archiver
- name: Upload
uses: actions/upload-artifact@v4
with:
name: universal-apple-archiver
path: archiver
publish:
needs: [build, build-macos-universal]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v4
with:
name: universal-apple-archiver
path: apple
- uses: actions/download-artifact@v4
with:
name: x86_64-windows-archiver
path: windows
- uses: actions/download-artifact@v4
with:
name: x86_64-linux-archiver
path: linux
- name: Rename
run: |
mv apple/archiver apple-archiver
mv windows/archiver.exe windows-archiver.exe
mv linux/archiver linux-archiver
chmod +x apple-archiver
chmod +x linux-archiver
- name: Extract Release Version
if: startsWith(github.ref, 'refs/tags/')
id: get_version
shell: bash
run: echo ::set-output name=version::${GITHUB_REF#refs/tags/v}
- name: Release Notes
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: changelogs/notes.sh ${{ steps.get_version.outputs.version }} > notes-${{ steps.get_version.outputs.version }}.md
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: archiver v${{ steps.get_version.outputs.version }}
body_path: notes-${{ steps.get_version.outputs.version }}.md
files: |
apple-archiver
linux-archiver
windows-archiver.exe