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
name: Release
on:
push:
tags:
- 'v*'
env:
CARGO_TERM_COLOR: always
jobs:
release:
name: Build and Release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary_name: vika-cli-linux-x86_64
asset_name: vika-cli-linux-x86_64
- os: macos-latest
target: x86_64-apple-darwin
binary_name: vika-cli-macos-x86_64
asset_name: vika-cli-macos-x86_64
- os: macos-latest
target: aarch64-apple-darwin
binary_name: vika-cli-macos-arm64
asset_name: vika-cli-macos-arm64
- os: windows-latest
target: x86_64-pc-windows-msvc
binary_name: vika-cli.exe
asset_name: vika-cli-windows-x86_64.exe
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build binary
run: cargo build --release --target ${{ matrix.target }}
- name: Prepare binary
shell: bash
run: |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
cp target/${{ matrix.target }}/release/vika-cli.exe ${{ matrix.asset_name }}
else
cp target/${{ matrix.target }}/release/vika-cli ${{ matrix.asset_name }}
chmod +x ${{ matrix.asset_name }}
fi
- name: Generate checksum
shell: bash
run: |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
certutil -hashfile ${{ matrix.asset_name }} SHA256 > ${{ matrix.asset_name }}.sha256
else
shasum -a 256 ${{ matrix.asset_name }} > ${{ matrix.asset_name }}.sha256
fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: |
${{ matrix.asset_name }}
${{ matrix.asset_name }}.sha256
create-release:
name: Create Release
needs: release
runs-on: ubuntu-latest
permissions:
contents: write
actions: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Extract version from tag
id: tag
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Prepare release files
run: |
# Move all artifacts to a single directory
mkdir -p release-assets
find artifacts -type f -exec cp {} release-assets/ \;
# Copy install scripts to release assets
cp install.sh release-assets/
cp install.ps1 release-assets/
# Make install scripts executable
chmod +x release-assets/install.sh
ls -la release-assets/
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: release-assets/*
name: Release ${{ steps.tag.outputs.VERSION }}
body: |
## Changes
See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details.
## Installation
### macOS / Linux
```bash
curl -fsSL https://github.com/${{ github.repository }}/releases/latest/download/install.sh | sh
```
### Windows (PowerShell)
```powershell
irm https://github.com/${{ github.repository }}/releases/latest/download/install.ps1 | iex
```
### Cargo
```bash
cargo install vika-cli
```
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}