Repository navigation
106 lines (90 loc) · 3.28 KB
/
Copy pathdeploy.yaml
File metadata and controls
106 lines (90 loc) · 3.28 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
name: Build and Publish Desktop Release
on:
release:
types: [created]
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
release:
name: Release - ${{ matrix.platform.os }}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- os: ubuntu-latest
os-name: linux
asset-name: code-parser-linux
asset-extension: .tar.gz
target: x86_64-unknown-linux-gnu
- os: macos-latest
os-name: macos
asset-name: code-parser-macos
asset-extension: .tar.gz
target: x86_64-apple-darwin
- os: windows-latest
os-name: windows
asset-name: code-parser-windows
asset-extension: .zip
target: x86_64-pc-windows-msvc
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform.target }}
- name: Install Linux dependencies
if: matrix.platform.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: Build Release Binary
run: |
cargo build --release --target ${{ matrix.platform.target }}
- name: Prepare Release Asset (Linux/macOS)
if: matrix.platform.os != 'windows-latest'
run: |
cd target/${{ matrix.platform.target }}/release
tar czvf ../../../${{ matrix.platform.asset-name }}${{ matrix.platform.asset-extension }} code-parser
cd -
- name: Prepare Release Asset (Windows)
if: matrix.platform.os == 'windows-latest'
run: |
cd target/${{ matrix.platform.target }}/release
7z a ../../../${{ matrix.platform.asset-name }}${{ matrix.platform.asset-extension }} code-parser.exe
cd -
- name: Generate SHA256 Checksum
run: |
if [ "${{ matrix.platform.os }}" = "windows-latest" ]; then
certutil -hashfile ${{ matrix.platform.asset-name }}${{ matrix.platform.asset-extension }} SHA256 | grep -v "SHA256" | grep -v "CertUtil" > ${{ matrix.platform.asset-name }}.sha256
else
shasum -a 256 ${{ matrix.platform.asset-name }}${{ matrix.platform.asset-extension }} | cut -d ' ' -f 1 > ${{ matrix.platform.asset-name }}.sha256
fi
shell: bash
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
with:
files: |
${{ matrix.platform.asset-name }}${{ matrix.platform.asset-extension }}
${{ matrix.platform.asset-name }}.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-crate:
name: Publish to crates.io
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Publish to crates.io
uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}