forked from tsukinaha/tsukimi
-
Notifications
You must be signed in to change notification settings - Fork 0
175 lines (156 loc) · 6.71 KB
/
build_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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: feature/win - Publishing
on:
workflow_dispatch:
push:
tags:
- v*
env:
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
RUST_BACKTRACE: full
jobs:
build:
strategy:
matrix:
include:
- arch: x86_64-windows-gnu
os: windows-latest
target: x86_64-pc-windows-gnu
artifact: tsukimi.exe
- arch: x86_64-linux-gnu
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact: tsukimi
runs-on: ${{matrix.os}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
run: >
rustup default stable-gnu;
C:\msys64\usr\bin\pacman.exe -Sy --needed --noconfirm mingw-w64-x86_64-pkgconf mingw-w64-x86_64-gcc
mingw-w64-x86_64-mpv mingw-w64-x86_64-libadwaita mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-good
mingw-w64-x86_64-gst-plugins-bad mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav;
C:\msys64\usr\bin\pacman.exe -Syu --noconfirm
- name: Install clapper
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
run: |
mkdir clapper-dev && cd clapper-dev
Invoke-WebRequest -Uri "https://github.com/Kosette/clapper/releases/latest/download/clapper-dev.7z" -OutFile clapper-dev.7z
7z.exe x clapper-dev.7z && rm clapper-dev.7z
cp -recurse -force bin C:/msys64/mingw64/
cp -recurse -force include C:/msys64/mingw64/
cp -recurse -force lib C:/msys64/mingw64/
- name: Build ${{ matrix.target }}
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
run: |
$env:Path = "C:\msys64\mingw64\bin;C:\msys64\mingw64\lib;C:\msys64\mingw64\include;" + $env:Path;
cargo build --release --locked
mkdir artifact && cd artifact
mkdir tsukimi-windows-gnu-amd64/ && cd tsukimi-windows-gnu-amd64/ && mkdir bin/ && mkdir share/ && mkdir lib/
cp ../../target/release/${{ matrix.artifact }} bin/
cp C:/msys64/mingw64/bin/*.dll bin/
cp -recurse C:/msys64/mingw64/lib/gdk-pixbuf-2.0 lib/
remove-item lib/gdk-pixbuf-2.0/2.10.0/loaders/* -exclude "*svg.dll"
cp -recurse C:/msys64/mingw64/share/glib-2.0 share/
get-childitem -directory -path share/glib-2.0/ -exclude "*schemas*"|remove-item -recurse
mv ../../moe.tsuna.tsukimi.gschema.xml share/glib-2.0/schemas/
C:/msys64/mingw64/bin/glib-compile-schemas.exe share/glib-2.0/schemas/
gci -recurse -path share/glib-2.0/* -exclude "*.compiled"|remove-item -recurse
cp -recurse C:/msys64/mingw64/lib/gio lib/
cp -recurse C:/msys64/mingw64/lib/gstreamer-1.0 lib/ && gci -recurse -path lib/gstreamer-1.0 -exclude "*.dll"|remove-item -recurse
cp -recurse C:/msys64/mingw64/share/icons share/
cp ../../resources/ui/icons/tsukimi.png share/icons/
remove-item -recurse share/icons/hicolor && remove-item -recurse share/icons/Adwaita/scalable && remove-item -recurse share/icons/Adwaita/cursors
remove-item -recurse share/icons/Adwaita/16x16 && remove-item -recurse share/icons/Adwaita/symbolic-up-to-32
gci -directory -recurse .|where-object {$_.getfilesysteminfos().count -eq 0}|remove-item -recurse
compress-archive -path ./* -destinationpath ../tsukimi-${{matrix.arch}}.zip
7z.exe a ../tsukimi-${{matrix.arch}}.7z ./*
- name: Build Complete Package
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
run: |
cd artifact/ && cp -r tsukimi-windows-gnu-amd64 tsukimi-windows-gnu-amd64-complete && cd tsukimi-windows-gnu-amd64-complete && mkdir mpv && cd mpv
Invoke-WebRequest -Uri "https://github.com/ZBound/tkm-config/releases/latest/download/mqv.7z" -OutFile mpv.7z
7z.exe x mpv.7z && rm mpv.7z
7z.exe a ../../tsukimi-${{matrix.arch}}-complete.7z ../*
- name: Build ${{matrix.target}}
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }}
run: |
mkdir artifact
docker build -t tsukimi .
docker run -d --name tsukimi tsukimi
docker cp tsukimi:/usr/src/tsukimi/. artifact/
cd artifact
tar -czf tsukimi-x86_64-linux-gnu.tar.gz tsukimi moe.tsuna.tsukimi.gschema.xml
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: tsukimi-${{matrix.arch}}
path: |
artifact/tsukimi-*.zip
artifact/tsukimi-*.7z
artifact/tsukimi*.deb
artifact/tsukimi*.tar.gz
compression-level: 0
retention-days: 3
publish:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Extract packages
run: |
mv tsukimi-x86_64-windows-gnu/*.zip .
mv tsukimi-x86_64-windows-gnu/*.7z .
mv tsukimi-x86_64-linux-gnu/*.tar.gz .
mv tsukimi-x86_64-linux-gnu/*.deb .
rm -rf tsukimi-x86_64-windows-gnu
rm -rf tsukimi-x86_64-linux-gnu
- name: Calculate hash
run: |
sha512sum *.7z > tsukimi-7z.sha512sum
sha512sum tsukimi*.zip > tsukimi.sha512sum
sha512sum tsukimi*.7z >> tsukimi.sha512sum
sha512sum tsukimi*.tar.gz >> tsukimi.sha512sum
sha512sum tsukimi*.deb >> tsukimi.sha512sum
- name: Get latest tag name
run: echo "TAG_NAME=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Get latest CHANGELOG
run: |
sudo apt install mawk -y
awk '/^## /{if(++count==2){exit}next}count==1{print}' CHANGELOG.md >> ${{github.workspace}}-CHANGELOG.md
- name: Prerelease
uses: softprops/action-gh-release@v2
if: ${{ contains(github.ref, '-preview') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: ${{github.workspace}}-CHANGELOG.md
prerelease: true
files: |
*.zip
*.7z
*.tar.gz
*.deb
*.sha512sum
tag_name: ${{ env.TAG_NAME }}
- name: Release
uses: softprops/action-gh-release@v2
if: ${{ !contains(github.ref , '-preview') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: ${{github.workspace}}-CHANGELOG.md
files: |
*.zip
*.7z
*.tar.gz
*.deb
*.sha512sum
tag_name: ${{ env.TAG_NAME }}