Skip to content

Commit d5492e2

Browse files
authored
[CI] Add Flatpak and macOS M1 Builds (#303)
* fix: proper build arm64 macOS builds * feat: hyperplay flatpak CI workflow * fix: permission tokens * fix: build command
1 parent 1a47458 commit d5492e2

12 files changed

+597
-7
lines changed

.github/workflows/build.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,18 @@ jobs:
9090
- name: Install modules.
9191
run: yarn
9292
- name: Build artifacts.
93-
run: yarn dist:mac --publish=never
93+
run: yarn dist:mac --x64 --arm64 --publish=never
9494
env:
9595
NOTARIZE: false
96-
- name: Upload x64 build.
96+
- name: Upload Intel build.
9797
uses: actions/upload-artifact@v3
9898
with:
99-
name: mac-dmg-x64
99+
name: mac-dmg-Intel
100100
path: dist/HyperPlay*x64.dmg
101101
retention-days: 14
102-
- name: Upload ARM64.
102+
- name: Upload M1/M2.
103103
uses: actions/upload-artifact@v3
104104
with:
105-
name: mac-dmg-arm64
105+
name: mac-dmg-M1-M2
106106
path: dist/HyperPlay*arm64.dmg
107107
retention-days: 14

.github/workflows/flatpak-build.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Flatpak-CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main, stable]
8+
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: 'Build Flatpak Files'
12+
required: false
13+
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
16+
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
17+
RUDDERSTACK_CLIENT_ID: ${{ secrets.RUDDERSTACK_CLIENT_ID }}
18+
19+
jobs:
20+
flatpak:
21+
name: 'Flatpak Build'
22+
runs-on: ubuntu-latest
23+
container:
24+
image: bilelmoussaoui/flatpak-github-actions:freedesktop-22.08
25+
options: --privileged
26+
steps:
27+
- name: Checkout Repo
28+
uses: actions/checkout@v3
29+
with:
30+
submodules: 'recursive'
31+
token: ${{ secrets.pat }}
32+
- name: Setup NodeJS
33+
uses: actions/setup-node@v3
34+
with:
35+
node-version: '18'
36+
- name: Reconfigure git to use HTTP authentication
37+
run: >
38+
git config --global url."https://github.com/".insteadOf
39+
ssh://git@github.com/
40+
- name: Authenticate with private NPM package
41+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
42+
- name: Install modules.
43+
run: npm i --legacy-peer-deps
44+
- name: Build artifacts.
45+
run: npm run dist:linux tar.xz --publish=never
46+
- name: Prepare Flatpak
47+
run: npm run flatpak:prepare
48+
- name: Build Flatpak
49+
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
50+
with:
51+
bundle: hyperplay.flatpak
52+
manifest-path: flatpak-build/xyz.hyperplay.HyperPlay.yml
53+
cache-key: flatpak-builder-${{ github.sha }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
.env.development.local
1919
.env.test.local
2020
.env.production.local
21+
/flatpak-build
2122

2223
# editors
2324
/.idea

flatpak/flathub.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"only-arches": ["x86_64"]
3+
}
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff -ruN aria2-1.36.0/src/a2functional.h aria2/src/a2functional.h
2+
--- aria2-1.36.0/src/a2functional.h 2021-08-21 10:28:39.000000000 +0200
3+
+++ aria2/src/a2functional.h 2022-09-09 13:18:33.404636307 +0200
4+
@@ -103,7 +103,7 @@
5+
}
6+
7+
template <typename T>
8+
-class LeastRecentAccess : public std::binary_function<T, T, bool> {
9+
+class LeastRecentAccess {
10+
public:
11+
bool operator()(const std::shared_ptr<T>& lhs,
12+
const std::shared_ptr<T>& rhs) const
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff -Nrup a/CPP/Windows/ErrorMsg.cpp b/CPP/Windows/ErrorMsg.cpp
2+
--- a/CPP/Windows/ErrorMsg.cpp 2015-01-18 11:20:28.000000000 -0700
3+
+++ b/CPP/Windows/ErrorMsg.cpp 2019-09-24 13:01:18.887289152 -0600
4+
@@ -14,14 +14,14 @@ UString MyFormatMessage(DWORD errorCode)
5+
AString msg;
6+
7+
switch(errorCode) {
8+
- case ERROR_NO_MORE_FILES : txt = "No more files"; break ;
9+
- case E_NOTIMPL : txt = "E_NOTIMPL"; break ;
10+
- case E_NOINTERFACE : txt = "E_NOINTERFACE"; break ;
11+
- case E_ABORT : txt = "E_ABORT"; break ;
12+
- case E_FAIL : txt = "E_FAIL"; break ;
13+
- case STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ;
14+
- case E_OUTOFMEMORY : txt = "E_OUTOFMEMORY"; break ;
15+
- case E_INVALIDARG : txt = "E_INVALIDARG"; break ;
16+
+ case unsigned (ERROR_NO_MORE_FILES) : txt = "No more files"; break ;
17+
+ case unsigned (E_NOTIMPL) : txt = "E_NOTIMPL"; break ;
18+
+ case unsigned (E_NOINTERFACE) : txt = "E_NOINTERFACE"; break ;
19+
+ case unsigned (E_ABORT) : txt = "E_ABORT"; break ;
20+
+ case unsigned (E_FAIL) : txt = "E_FAIL"; break ;
21+
+ case unsigned (STG_E_INVALIDFUNCTION) : txt = "STG_E_INVALIDFUNCTION"; break ;
22+
+ case unsigned (E_OUTOFMEMORY) : txt = "E_OUTOFMEMORY"; break ;
23+
+ case unsigned (E_INVALIDARG) : txt = "E_INVALIDARG"; break ;
24+
case ERROR_DIRECTORY : txt = "Error Directory"; break ;
25+
default:
26+
txt = strerror(errorCode);

flatpak/prepareFlatpak.js

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
const { default: axios } = require('axios')
2+
const fs = require('fs')
3+
const package = require('../package.json')
4+
const child_process = require('child_process')
5+
const os = require('os')
6+
const crypto = require('crypto')
7+
8+
if (require.main === module) {
9+
main();
10+
}
11+
12+
async function main() {
13+
let placeholder = ""
14+
let releaseTime = ""
15+
if (process.argv[2] === "release") {
16+
const { data } = await axios.get("https://api.github.com/repos/HyperPlay-Gaming/hyperplay-desktop-client/releases/latest")
17+
const tarxz = data.assets.find((asset) => asset.browser_download_url.includes("tar.xz"))
18+
const outputFile = `${os.tmpdir()}/hyperplay.tar.xz`
19+
child_process.spawnSync("curl", ["-L", tarxz.browser_download_url, "-o", outputFile, "--create-dirs"])
20+
const outputContent = fs.readFileSync(outputFile)
21+
const hashSum = crypto.createHash('sha512');
22+
hashSum.update(outputContent);
23+
const sha512 = hashSum.digest('hex');
24+
fs.rmSync(outputFile)
25+
26+
placeholder = [
27+
"type: file",
28+
`url: ${tarxz.browser_download_url}`,
29+
`sha512: ${sha512}`
30+
].join("\n ")
31+
releaseTime = data.published_at.split('T')[0]
32+
} else {
33+
placeholder = [
34+
"type: file",
35+
`path: "../dist/hyperplay-${package.version}.tar.xz"`
36+
].join("\n ")
37+
releaseTime = new Date().toISOString().split('T')[0]
38+
}
39+
40+
// generate flatpak-build
41+
if (!fs.existsSync("./flatpak-build")) {
42+
fs.mkdirSync('./flatpak-build', { recursive: true })
43+
}
44+
45+
// generate manifest
46+
let templateManifest = fs.readFileSync(`./flatpak/templates/xyz.hyperplay.HyperPlay.yml.template`, { encoding: 'utf-8' })
47+
templateManifest = templateManifest.replace("${hyperplay-tarxz}", placeholder)
48+
fs.writeFileSync("./flatpak-build/xyz.hyperplay.HyperPlay.yml", templateManifest)
49+
50+
// generate metainfo
51+
let templateMetaInfo = fs.readFileSync(`./flatpak/templates/xyz.hyperplay.HyperPlay.metainfo.xml.template`, { encoding: 'utf-8' })
52+
templateMetaInfo = templateMetaInfo.replace("${hyperplay-version}", `v${package.version}`).replace("${hyperplay-release-date}", releaseTime)
53+
fs.writeFileSync("./flatpak-build/xyz.hyperplay.HyperPlay.metainfo.xml", templateMetaInfo)
54+
55+
// copy extra files
56+
fs.copyFileSync("./flatpak/xyz.hyperplay.HyperPlay.desktop", "./flatpak-build/xyz.hyperplay.HyperPlay.desktop")
57+
fs.copyFileSync("./flatpak/xyz.hyperplay.HyperPlay.png", "./flatpak-build/xyz.hyperplay.HyperPlay.png")
58+
fs.copyFileSync("./flatpak/flathub.json", "./flatpak-build/flathub.json")
59+
fs.cpSync("./flatpak/patches", "./flatpak-build/patches", { recursive: true })
60+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<component type="desktop-application">
3+
<id>
4+
xyz.hyperplay.HyperPlay
5+
</id>
6+
<name>
7+
HyperPlay
8+
</name>
9+
<summary>
10+
Web3 game launcher from the future. Carry your wallet, NFTs, tokens, and achievements into every game.
11+
</summary>
12+
<url type="homepage">
13+
https://hyperplay.xyz
14+
</url>
15+
<url type="bugtracker">
16+
https://github.com/HyperPlay-Gaming/hyperplay-desktop-client/issues
17+
</url>
18+
<url type="vcs-browser">
19+
https://github.com/HyperPlay-Gaming/hyperplay-desktop-client
20+
</url>
21+
<metadata_license>
22+
CC0-1.0
23+
</metadata_license>
24+
<project_license>
25+
GPL-3.0
26+
</project_license>
27+
<description>
28+
<p>
29+
A web3- compatible game launcher from the future. Carry your wallet, NFTs, tokens, and achievements into every game.
30+
</p>
31+
<p>
32+
HyperPlay allows players to carry their MetaMask or WalletConnect wallet to native or browser based games. Games can request transactions or signatures with a simple REST API call that supports every wallet to manage wallet interactions seamlessly.
33+
</p>
34+
<p>
35+
You can also access your Epic and GOG games and play them using Proton or Wine which can be downloaded directly from the interface. DXVK, VKD3D, and Winetricks are also included to play Windows Games.
36+
</p>
37+
<ul>
38+
<li>
39+
Seamless wallet integration with MetaMask, WalletConnect, and more
40+
</li>
41+
<li>
42+
Play Web3 native or browser games and make transactions without leaving the game
43+
</li>
44+
<li>
45+
Have access to your MetaMask Portfolio from the app interface
46+
</li>
47+
<li>
48+
Access Epic and GOG games as well
49+
</li>
50+
</ul>
51+
</description>
52+
<content_rating type="oars-1.1">
53+
<content_attribute id="violence-cartoon">
54+
moderate
55+
</content_attribute>
56+
<content_attribute id="violence-fantasy">
57+
moderate
58+
</content_attribute>
59+
<content_attribute id="violence-realistic">
60+
moderate
61+
</content_attribute>
62+
<content_attribute id="violence-bloodshed">
63+
moderate
64+
</content_attribute>
65+
<content_attribute id="money-purchasing">
66+
intense
67+
</content_attribute>
68+
</content_rating>
69+
<launchable type="desktop-id">
70+
xyz.hyperplay.HyperPlay.desktop
71+
</launchable>
72+
<screenshots>
73+
<screenshot type="default">
74+
<caption>
75+
Onboarding
76+
</caption>
77+
<image>
78+
https://user-images.githubusercontent.com/26871415/221288765-41a7981c-4112-4881-a88b-c2ed08929090.png
79+
</image>
80+
</screenshot>
81+
<screenshot>
82+
<caption>
83+
Wallet Overlay
84+
</caption>
85+
<image>
86+
https://user-images.githubusercontent.com/26871415/221288900-aa7c3168-d610-4598-8011-7f6c4dc4148f.png
87+
</image>
88+
</screenshot>
89+
<screenshot>
90+
<caption>
91+
Library
92+
</caption>
93+
<image>
94+
https://user-images.githubusercontent.com/26871415/221288973-eb897dec-34fe-4edf-8c3d-32836ca59a04.png
95+
</image>
96+
</screenshot>
97+
</screenshots>
98+
<releases>
99+
<release version="${hyperplay-version}" date="${hyperplay-release-date}">
100+
<description>
101+
<p>
102+
General
103+
</p>
104+
<ul>
105+
<li>
106+
Improved MetaMask extension UI/UX in client and overlay
107+
</li>
108+
<li>
109+
MetaMask has been updated to the latest version
110+
</li>
111+
<li>
112+
Show MetaMask extension in overlay on notification automatically
113+
</li>
114+
<li>
115+
Show MetaMask extension in overlay on notification automatically
116+
</li>
117+
</ul>
118+
<p>
119+
BugFixes
120+
</p>
121+
<ul>
122+
<li>
123+
Browser games that open new windows will now have the same MetaMask overlay
124+
</li>
125+
<li>
126+
Import exe is now import folder to fix importing games with nested directories
127+
</li>
128+
</ul>
129+
</description>
130+
</release>
131+
</releases>
132+
</component>

0 commit comments

Comments
 (0)