-
-
Notifications
You must be signed in to change notification settings - Fork 5
159 lines (154 loc) · 5.41 KB
/
release-packages.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
name: Draft New Release with Distributables
on:
workflow_dispatch:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
create_release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.get_version.outputs.VERSION }}
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
windows:
needs: create_release
runs-on: windows-latest
env:
EMULSION_VERSION: ${{ needs.create_release.outputs.version }}
INSTALLER_NAME: ${{ format('Emulsion-Windows-{0}.exe', needs.create_release.outputs.version) }}
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Print installer name
run: |
Write-Host $Env:INSTALLER_NAME
- name: Install NSIS
run: |
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
scoop bucket add extras
scoop install nsis
- name: Print NSIS version
run: makensis -VERSION
- name: Checkout code
uses: actions/checkout@v2
- name: Fetch Prerequisites
working-directory: ./distribution/windows/prerequisites
run: (New-Object System.Net.WebClient).DownloadFile('https://aka.ms/vs/16/release/vc_redist.x64.exe', 'vc_redist.x64.exe')
- name: Install avif build dependencies (Windows)
run: |
choco install -y ninja
pip install meson
$NASM_VERSION="2.15.02"
$LINK="https://www.nasm.us/pub/nasm/releasebuilds/$NASM_VERSION/win64"
curl -LO "$LINK/nasm-$NASM_VERSION-win64.zip"
7z e -y "nasm-$NASM_VERSION-win64.zip" -o"C:\nasm"
echo "C:\nasm" >> $env:GITHUB_PATH
- name: Build executable
shell: cmd
run: |
call "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
cargo build --release --features=networking,avif
- name: Copy executable to distributable folder
working-directory: ./distribution/windows/
shell: cmd
run: |
mkdir program
copy /y ..\..\target\release\emulsion.exe program\emulsion.exe
- name: Create installer
working-directory: ./distribution/windows/
run: |
makensis /DVERSION=$Env:EMULSION_VERSION emulsion.nsi
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./distribution/windows/Emulsion-Installer.exe
asset_name: ${{ env.INSTALLER_NAME }}
asset_content_type: application/octet-stream
osx:
needs: create_release
runs-on: macos-latest
env:
INSTALLER_NAME: ${{ format('Emulsion-OSX-{0}.dmg', needs.create_release.outputs.version) }}
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Checkout code
uses: actions/checkout@v2
- name: Install cargo bundle
run: cargo install cargo-bundle
- name: Install avif build dependencies (macOS)
run: |
brew install ninja nasm meson
- name: Create osx app
run: cargo bundle --release --features=avif
- name: Install create-dmg
run: npm install --global create-dmg
- name: Create .dmg file
run: ./distribution/macos/create_dmg.sh
- name: Rename .dmg
run: mv Emulsion*.dmg Emulsion.dmg
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: Emulsion.dmg
asset_name: ${{ env.INSTALLER_NAME }}
asset_content_type: application/octet-stream
linux:
needs: create_release
runs-on: ubuntu-20.04
env:
INSTALLER_NAME: ${{ format('Emulsion-Linux.deb-{0}.deb', needs.create_release.outputs.version) }}
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Checkout code
uses: actions/checkout@v2
- name: Install cargo bundle
run: cargo install cargo-bundle
- name: Install avif build dependencies (linux)
run: |
DEBIAN_FRONTEND=noninteractive sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y ninja-build nasm meson
- name: Create deb package
run: cargo bundle --release --features=avif
- name: Rename .deb
run: mv target/release/bundle/deb/*.deb Emulsion.deb
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: Emulsion.deb
asset_name: ${{ env.INSTALLER_NAME }}
asset_content_type: application/octet-stream