-
Notifications
You must be signed in to change notification settings - Fork 1
147 lines (147 loc) · 6.2 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
139
140
141
142
143
144
145
146
147
# .github/workflows/release.yml
name: All
on:
release:
types: [created]
jobs:
build:
name: Build Release Binaries
continue-on-error: true
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
name: spaceman-x86_64-linux.tar.xz
os: ubuntu-latest
- target: x86_64-apple-darwin
name: spaceman-x86_64-osx.tar.gz
os: macos-latest
#- target: aarch64-apple-darwin
# name: spaceman-aarch64-osx.tar.gz
# os: macos-latest
- target: x86_64-pc-windows-gnu
name: spaceman-x86_64-windows.zip
os: windows-latest
PKG_CONFIG_SYSROOT_DIR: 'C:/my_msys2/msys64/mingw64/'
PKG_CONFIG_PATH: 'C:/my_msys2/msys64/mingw64/lib/pkgconfig/'
runs-on: ${{ matrix.os }}
steps:
- name: Get release information
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup | Checkout
uses: actions/checkout@v2
- name: Setup | Cache Cargo
uses: actions/[email protected]
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Setup | Install Dependencies | Linux
if: matrix.os == 'ubuntu-latest'
env:
DEBIAN_FRONTEND: noninteractive
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y
build-essential pkg-config libgtk-4-dev
- name: Setup | Install Dependencies | MacOS-x86_64
if: matrix.target == 'x86_64-apple-darwin'
run: brew install gtk4
- name: Setup | Install Dependencies | MacOS-aarch64
if: matrix.target == 'aarch64-apple-darwin'
run: |-
brew fetch --force --bottle-tag=arm64_big_sur gtk4 gdk-pixbuf graphene hicolor-icon-theme libepoxy fribidi pango
brew --cache --bottle-tag=arm64_big_sur gtk4 gdk-pixbuf graphene hicolor-icon-theme libepoxy fribidi pango
- name: Setup | Rust
uses: actions-rs/[email protected]
with:
toolchain: stable
override: true
profile: minimal
target: ${{ matrix.target }}
- name: Setup | MSYS2 | Windows
if: matrix.target == 'x86_64-pc-windows-gnu'
uses: msys2/setup-msys2@v2
with:
update: true
location: C:\my_msys2\
install: >-
mingw-w64-x86_64-gtk4
mingw-w64-x86_64-gsettings-desktop-schemas
mingw-w64-x86_64-gettext
mingw-w64-x86_64-libxml2
mingw-w64-x86_64-librsvg
mingw-w64-x86_64-pkgconf
mingw-w64-x86_64-gcc
- name: Add MSYS2 to PATH | Windows
if: matrix.target == 'x86_64-pc-windows-gnu'
shell: pwsh
run: |
echo "C:\my_msys2\msys64\mingw64\include" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\my_msys2\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\my_msys2\msys64\mingw64\lib" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
msys2 -c 'pacman --noconfirm -U https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-pkgconf-1~1.8.0-2-any.pkg.tar.zst'
- name: Build
uses: actions-rs/[email protected]
with:
command: build
args: --release --locked --target ${{ matrix.target }}'
use-cross: ${{ matrix.os == 'ubuntu-latest' && matrix.target !=
'x86_64-unknown-linux-gnu' }}
env:
PKG_CONFIG_SYSROOT_DIR: ${{matrix.PKG_CONFIG_SYSROOT_DIR}}
PKG_CONFIG_PATH: ${{matrix.PKG_CONFIG_PATH}}
- name: PostBuild | Prepare | Non-Windows
if: matrix.os != 'windows-latest'
run: |-
mkdir pkg
cp target/${{ matrix.target }}/release/spaceman pkg/
cd pkg
strip ./spaceman || true
tar -cJvf ../${{ matrix.name }} spaceman
cd -
- name: PostBuild | Prepare | Windows
if: matrix.os == 'windows-latest'
run: |-
$MSYS="C:/my_msys2/msys64/mingw64/"
mkdir spaceman
cp target/${{ matrix.target }}/release/spaceman.exe spaceman/
cd spaceman
mkdir bin
bash -c "ldd spaceman.exe | grep '\/mingw.*\.dll' -o | sed -z 's/[\n\r]/ /g' | xargs -d ' ' -IECHIDNA cp /c/my_msys2/msys64/ECHIDNA ./bin/"
# These would be ideal to include but sacrifice them for package size
# cp $MSYS/bin/gdbus.exe ./bin/
# bash -c "ldd bin/gdbus.exe | grep '\/mingw.*\.dll' -o | sed -z 's/[\n\r]/ /g' | xargs -d ' ' -IECHIDNA cp /c/my_msys2/msys64/ECHIDNA ./bin/"
# cp $MSYS/bin/gspawn-win64-helper.exe ./bin/
# bash "ldd bin/gspawn-win64-helper.exe | grep '\/mingw.*\.dll' -o | sed -z 's/[\n\r]/ /g' | xargs -d ' ' -IECHIDNA cp /c/my_msys2/msys64/ECHIDNA ./bin/"
# cp $MSYS/bin/libgst*.dll ./bin/
# cp $MSYS/bin/liborc-0.4-0.dll ./bin/
# cp $MSYS/bin/libGLESv2.dll ./bin/
# cp $MSYS/bin/libEGL.dll ./bin/
mv spaceman.exe bin/
strip bin/spaceman.exe
strip bin/*.dll
mkdir -p share/glib-2.0/schemas/
glib-compile-schemas $MSYS/share/glib-2.0/schemas/
cp -r $MSYS/share/glib-2.0/schemas/gschemas.compiled share/glib-2.0/schemas/
mkdir -p lib
cp -r $MSYS/lib/gdk-pixbuf-2.0 lib/
# cp -r $MSYS/lib/gtk-4.0 lib/
echo "${{ steps.get_release.outputs.name }}" > readme.txt
echo "To start the program, run bin/spaceman.exe" >> readme.txt
echo "" >> readme.txt
echo "https://github.com/salihgerdan/spaceman" >> readme.txt
cd ..
7z a -r ${{ matrix.name }} spaceman
- name: Upload release binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ${{ matrix.name }}
asset_name: ${{ matrix.name }}
asset_content_type: application/octet-stream