-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (87 loc) · 3.17 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
name: release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
permissions:
contents: write
jobs:
Create-Release:
name: Create-Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get the tag name
if: env.VERSION == ''
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Print Version
run: echo "$VERSION"
- name: Print Cargo Version
run: cargo -V
- name: Package Version
run: echo "PKG_VERSION=$(cargo metadata --no-deps --format-version 1 | jq '.packages[0].version' | head -n 1)" >> $GITHUB_ENV
- name: Print Package Version
run: echo "$PKG_VERSION"
- name: Check Version
run: |
if ! [ "$PKG_VERSION" == "${VERSION#v}" ]; then
echo "Cargo package version does not match tag"
# exit 1
fi
- name: Print Cargo Version
run: cargo -V
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create $VERSION --draft --verify-tag --title $VERSION --generate-notes
outputs:
version: ${{ env.VERSION }}
pkg_version: ${{ env.PKG_VERSION }}
Build:
name: Build-Packages
needs: ['Create-Release']
runs-on: ubuntu-latest
env:
VERSION: ${{needs.Create-Release.outputs.version}}
PKG_VERSION: ${{needs.Create-Release.outputs.pkg_version}}
steps:
- uses: actions/checkout@v4
- name: Install cargo-deb
run: cargo install cargo-deb
- name: Build Binary
run: cargo build --release
- name: Build Deb Package
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cargo deb
gh release upload "$VERSION" ./target/debian/ebook2audiobook_${{ env.PKG_VERSION }}-1_amd64.deb
Build_MacOS:
name: Build_MacOS
needs: ['Create-Release']
runs-on: macos-latest
env:
VERSION: ${{needs.Create-Release.outputs.version}}
PKG_VERSION: ${{needs.Create-Release.outputs.pkg_version}}
steps:
- uses: actions/checkout@v4
- name: Build MacOS Apple Silicon
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cargo build --release --target aarch64-apple-darwin
mv ./target/aarch64-apple-darwin/release/ebook2audiobook ./target/aarch64-apple-darwin/release/ebook2audiobook_${{ env.PKG_VERSION }}_macosarm
gh release upload "$VERSION" ./target/aarch64-apple-darwin/release/ebook2audiobook_${{ env.PKG_VERSION }}_macosarm
- name: Install MacOS x86 toolchain
run: rustup target add x86_64-apple-darwin
- name: Build MacOS x86
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cargo build --release --target x86_64-apple-darwin
mv ./target/x86_64-apple-darwin/release/ebook2audiobook ./target/x86_64-apple-darwin/release/ebook2audiobook_${{ env.PKG_VERSION }}_macosx86
gh release upload "$VERSION" ./target/x86_64-apple-darwin/release/ebook2audiobook_${{ env.PKG_VERSION }}_macosx86
ls -la ./target/x86_64-apple-darwin/release/