-
Notifications
You must be signed in to change notification settings - Fork 24
165 lines (142 loc) · 4.83 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Release
on:
push:
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 480
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
cache-on-failure: true
- name: Get the release version from the tag
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
- name: Install cargo-deb
uses: taiki-e/cache-cargo-install-action@v2
with:
tool: cargo-deb
- name: Install cargo-generate-rpm
uses: taiki-e/install-action@v2
with:
tool: cargo-generate-rpm
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y protobuf-compiler libclang-dev
- name: Build binaries
shell: bash
run: |
cargo build --release --bins --workspace --exclude hdfs --target ${{ matrix.target }}
- name: Build archive client(DEB)
shell: bash
run: |
binary_name="client"
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
cargo deb -p dragonfly-client --target ${{ matrix.target }} --variant ${{ matrix.target }} --compress-type gzip --output $dirname.deb
echo "CLIENT_DEB_ASSET=$dirname.deb" >> $GITHUB_ENV
- name: Build archive client(RPM)
shell: bash
run: |
binary_name="client"
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
cargo generate-rpm -p dragonfly-client --target ${{ matrix.target }} --variant ${{ matrix.target }} --payload-compress none --output $dirname.rpm
echo "CLIENT_RPM_ASSET=$dirname.rpm" >> $GITHUB_ENV
- name: Build archive client(TAR)
shell: bash
run: |
binary_name="client"
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
mkdir -p "$dirname"
mv "target/${{ matrix.target }}/release/dfget" "$dirname"
mv "target/${{ matrix.target }}/release/dfdaemon" "$dirname"
mv "target/${{ matrix.target }}/release/dfstore" "$dirname"
mv "target/${{ matrix.target }}/release/dfcache" "$dirname"
mv "target/${{ matrix.target }}/release/dfinit" "$dirname"
mv CONTRIBUTING.md LICENSE README.md "$dirname"
tar -czf "$dirname.tar.gz" "$dirname"
echo "CLIENT_TAR_ASSET=$dirname.tar.gz" >> $GITHUB_ENV
- name: Upload Release Artifacts
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.target }}
path: |
${{ env.CLIENT_RPM_ASSET }}
${{ env.CLIENT_DEB_ASSET }}
${{ env.CLIENT_TAR_ASSET }}
release-github:
runs-on: ubuntu-latest
timeout-minutes: 360
needs: [build]
permissions:
contents: write
steps:
- name: Download Release Artifacts
uses: actions/download-artifact@v4
with:
path: releases
pattern: release-*
merge-multiple: true
- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: "releases/*"
generateReleaseNotes: true
allowUpdates: true
draft: true
publish-crates:
runs-on: ubuntu-latest
timeout-minutes: 360
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install protobuf-compiler libclang-dev
- uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
ignore-unpublished-changes: true