-
Notifications
You must be signed in to change notification settings - Fork 6
87 lines (70 loc) · 2.2 KB
/
release-github.yml
File metadata and controls
87 lines (70 loc) · 2.2 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
name: GitHub Release
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
env:
# The smbcloud-cli binary name
PROJECT_NAME: smb
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- name: linux-amd64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
- name: win-amd64
runner: windows-latest
target: x86_64-pc-windows-msvc
#- name: macos-amd64
# runner: macos-latest
# target: x86_64-apple-darwin
- name: macos-arm64
runner: macos-latest
target: aarch64-apple-darwin
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.92
targets: "${{ matrix.target }}"
#- name: Install OpenSSL
# if: matrix.name == 'macos-amd64'
# run: brew install openssl@3
- name: Setup Cache
uses: Swatinem/rust-cache@v2
- name: Create .env file
run: |
touch .env
echo CLI_CLIENT_SECRET=${{ secrets.CLI_CLIENT_SECRET }} >> .env
cat .env
- name: Build Binary
run: cargo build --verbose --locked --release --target ${{ matrix.target }}
- name: Release Binary
shell: bash
run: |
BIN_SUFFIX=""
if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then
BIN_SUFFIX=".exe"
fi
# The built binary output location
BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}"
# Define a better name for the final binary
BIN_RELEASE="${PROJECT_NAME}-${{ matrix.name }}${BIN_SUFFIX}"
BIN_RELEASE_VERSIONED="${PROJECT_NAME}-${{ github.ref_name }}-${{ matrix.name }}${BIN_SUFFIX}"
# Move the built binary where you want it
DEST_DIR="./release"
mkdir -p "${DEST_DIR}"
mv "${BIN_OUTPUT}" "${DEST_DIR}/${BIN_RELEASE}"
- name: Release
uses: softprops/action-gh-release@v2
if: github.ref_type == 'tag'
with:
files: release/*