-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (108 loc) · 4.3 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
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
136
137
138
on:
workflow_dispatch:
name: Artifacts
env:
RELEASE_BIN: dovi_meta
RELEASE_DIR: artifacts
WINDOWS_TARGET: x86_64-pc-windows-msvc
MACOS_X86_TARGET: x86_64-apple-darwin
MACOS_ARM_TARGET: aarch64-apple-darwin
LINUX_TARGET: x86_64-unknown-linux-musl
jobs:
linux-binary:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-release-env
- name: Install musl-tools
run: |
sudo apt-get update -y
sudo apt-get install musl-tools -y
- name: Build
run: |
rustup target add ${{ env.LINUX_TARGET }}
cargo build --release --target ${{ env.LINUX_TARGET }}
- name: Create tarball and checksum
run: |
ARCHIVE_FILE=${{ env.RELEASE_DIR }}/${{ env.ARCHIVE_PREFIX }}-${{ env.LINUX_TARGET }}.tar.gz
strip ./target/${{ env.LINUX_TARGET }}/release/${{ env.RELEASE_BIN }}
mv ./target/${{ env.LINUX_TARGET }}/release/${{ env.RELEASE_BIN }} ./${{ env.RELEASE_BIN }}
tar -cvzf ./${ARCHIVE_FILE} ./${{ env.RELEASE_BIN }}
python -c "import hashlib; import pathlib; print(hashlib.sha256(pathlib.Path('${ARCHIVE_FILE}').read_bytes()).hexdigest())" > ${ARCHIVE_FILE}.sha256
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Linux artifacts
path: ./${{ env.RELEASE_DIR }}/*
windows-binary:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-release-env
- name: Install cargo-c
run: |
$LINK = "https://github.com/lu-zero/cargo-c/releases/latest/download"
$CARGO_C_FILE = "cargo-c-windows-msvc"
curl -LO "$LINK/$CARGO_C_FILE.zip"
7z e -y "$CARGO_C_FILE.zip" -o"${env:USERPROFILE}\.cargo\bin"
- name: Build
run: cargo build --release
- name: Create zipfile
shell: bash
run: |
ARCHIVE_FILE=${{ env.RELEASE_DIR }}/${{ env.ARCHIVE_PREFIX }}-${{ env.WINDOWS_TARGET }}.zip
mv ./target/release/${{ env.RELEASE_BIN }}.exe ./${{ env.RELEASE_BIN }}.exe
7z a ./${ARCHIVE_FILE} ./${{ env.RELEASE_BIN }}.exe
python -c "import hashlib; import pathlib; print(hashlib.sha256(pathlib.Path('${ARCHIVE_FILE}').read_bytes()).hexdigest())" > ${ARCHIVE_FILE}.sha256
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Windows artifacts
path: ./${{ env.RELEASE_DIR }}/*
macos-binary:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-release-env
- name: Build
run: |
rustup target add ${{ env.MACOS_X86_TARGET }}
cargo build --release
cargo build --release --target ${{ env.MACOS_X86_TARGET }}
- name: Create universal macOS binary
run: |
strip ./target/release/${{ env.RELEASE_BIN }}
strip ./target/${{ env.MACOS_X86_TARGET }}/release/${{ env.RELEASE_BIN }}
lipo -create \
./target/${{ env.MACOS_X86_TARGET }}/release/${{ env.RELEASE_BIN }} \
./target/release/${{ env.RELEASE_BIN }} \
-output ./${{ env.RELEASE_BIN }}
- name: Create zipfile
run: |
ARCHIVE_FILE=${{ env.RELEASE_DIR }}/${{ env.ARCHIVE_PREFIX }}-universal-macOS.zip
zip -9 ./${ARCHIVE_FILE} ./${{ env.RELEASE_BIN }}
python -c "import hashlib; import pathlib; print(hashlib.sha256(pathlib.Path('${ARCHIVE_FILE}').read_bytes()).hexdigest())" > ${ARCHIVE_FILE}.sha256
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: macOS artifacts
path: ./${{ env.RELEASE_DIR }}/*
create-release:
needs: [linux-binary, windows-binary, macos-binary]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Display structure of downloaded files
run: ls -R
- name: Create a draft release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.RELEASE_PKG_VERSION }}
draft: true
files: |
Linux artifacts/*
Windows artifacts/*
macOS artifacts/*