-
Notifications
You must be signed in to change notification settings - Fork 116
113 lines (100 loc) · 3.64 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
name: Build and Release
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
steps:
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/checkout@v2
- name: Build Client
run: cargo build --release --bin tunnelto --verbose
- name: Compress
run: tar -czvf tunnelto-${{ matrix.os }}.tar.gz target/release/tunnelto
- name: Upload Client Binary
uses: actions/upload-artifact@v1
with:
name: tunnelto-${{ matrix.os }}
path: target/release/tunnelto
build_win:
runs-on: windows-latest
steps:
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/checkout@v2
- name: Build Client
run: cargo build --release --bin tunnelto --verbose
- name: Upload Client Binary
uses: actions/upload-artifact@v1
with:
name: tunnelto-windows-latest.exe
path: target/release/tunnelto.exe
publish:
needs: [build, build_win]
runs-on: ubuntu-latest
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Download macOS
uses: actions/download-artifact@v1
with:
name: tunnelto-macOS-latest
path: macOS/tunnelto/${{ steps.get_version.outputs.VERSION }}/bin/
- name: Download ubuntu
uses: actions/download-artifact@v1
with:
name: tunnelto-ubuntu-latest
path: linux/
- name: Download windows
uses: actions/download-artifact@v1
with:
name: tunnelto-windows-latest.exe
path: windows/
- name: Compress
run: |
chmod +x macOS/tunnelto/${{ steps.get_version.outputs.VERSION }}/bin/tunnelto
chmod +x linux/tunnelto
export TAG="${{ steps.get_version.outputs.VERSION }}"
cp windows/tunnelto.exe tunnelto-windows.exe
tar -C macOS/ -czvf "tunnelto-$TAG.catalina.bottle.tar.gz" tunnelto/${{ steps.get_version.outputs.VERSION }}/bin/tunnelto
cp "tunnelto-$TAG.catalina.bottle.tar.gz" "tunnelto-$TAG.big_sur.bottle.tar.gz"
tar -C linux/ -czvf tunnelto-linux.tar.gz tunnelto
- name: Create Release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "tunnelto-${{ steps.get_version.outputs.VERSION }}.big_sur.bottle.tar.gz,tunnelto-${{ steps.get_version.outputs.VERSION }}.catalina.bottle.tar.gz,tunnelto-linux.tar.gz,tunnelto-windows.exe"
token: ${{ secrets.GITHUB_TOKEN }}