-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (62 loc) · 2.37 KB
/
publish.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
name: publish
on:
push:
tags:
- release-*.*.*
branches:
- main
- master
permissions:
contents: write
jobs:
publish:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]
include:
- os: macos-latest
name: MacOS Binary 64-Bit
target: x86_64-apple-darwin
target2: aarch64-apple-darwin
env:
MACOSX_DEPLOYMENT_TARGET: 10.7
- os: windows-latest
name: Windows Binary 64-Bit
target: x86_64-pc-windows-msvc
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Add rustup default target
run: rustup target add ${{ matrix.target }}
- name: Add rustup Apple ARM64 target
if: ${{ matrix.os == 'macos-latest' }}
run: rustup target add ${{ matrix.target2 }}
- name: Build default target in release mode
run: cargo build --release --target ${{ matrix.target }} --locked
- name: Build Apple ARM64 target in release mode
if: ${{ matrix.os == 'macos-latest' }}
run: cargo build --release --target ${{ matrix.target2 }} --locked
- name: Create zip file on Windows
if: ${{ matrix.os == 'windows-latest' }}
run: |
choco install zip
cd target/${{ matrix.target }}/release
zip vocab-vault-0.1.1-${{ matrix.target }}.zip vocab-vault.exe
cd ../../..
- name: Create tar.gz file on macOS
if: ${{ matrix.os == 'macos-latest' }}
run: |
chmod +x target/${{ matrix.target }}/release/vocab-vault
tar -zcf target/${{ matrix.target }}/release/vocab-vault-0.1.1-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release vocab-vault
chmod +x target/${{ matrix.target2 }}/release/vocab-vault
tar -zcf target/${{ matrix.target2 }}/release/vocab-vault-0.1.1-${{ matrix.target2 }}.tar.gz -C target/${{ matrix.target2 }}/release vocab-vault
- name: Upload release and assets to GitHub
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: "release-0.1.1-${{ github.run_number }}"
release_name: vocab-vault 0.1.1
file_glob: true
file: target/*/release/vocab-vault-0.1.1-*.{zip,tar.gz}