Skip to content

Commit

Permalink
Update build system and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Ecks1337 committed Aug 10, 2022
1 parent 9bb20f7 commit 54595c3
Show file tree
Hide file tree
Showing 7 changed files with 4,168 additions and 13,029 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build

on:
push:
branches-ignore:
- 'wip*'

pull_request:
branches:
- 'master'

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]

steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Setup NodeJS environment
uses: actions/setup-node@v3
with:
node-version: 14.20.0
cache: 'npm'

- name: Install dependencies
run: npm clean-install --include=dev

- name: Dump title IDs from Tinfoil DB
run: npm run tinfoil

- name: Dump eShop data
run: npm run eshop

- name: Build
run: npm run build

# If the action trigger was NOT a version tag
- name: Upload artifact
if: startsWith(github.ref, 'refs/tags/v') == false
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}
path: out/**/*

# If the action trigger was a version tag
- name: Make distributables
if: startsWith(github.ref, 'refs/tags/v')
run: npm run make

- name: Publish to Releases
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
draft: true
files: out/make/**/*
55 changes: 55 additions & 0 deletions .github/workflows/pr_comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Comment artifacts links on PRs

on:
workflow_run:
workflows: ['Build']
types: [completed]

jobs:
pr_comment:
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest

steps:
- uses: actions/github-script@v6
with:
script: |
const { owner, repo } = context.repo;
const run_id = ${{github.event.workflow_run.id}};
const pull_head_sha = "${{github.event.workflow_run.head_sha}}";
const issue_number = await (async () => {
const pulls = await github.rest.pulls.list({owner, repo});
for await (const { data } of github.paginate.iterator(pulls)) {
for (const pull of data) {
if (pull.head.sha === pull_head_sha) {
return pull.number;
}
}
}
})();
if (issue_number) {
core.info(`Matched pull request ${issue_number}`);
} else {
return core.error("No matching pull request found");
}
const { data: { artifacts } } = await github.rest.actions.listWorkflowRunArtifacts({owner, repo, run_id});
if (!artifacts.length) {
return core.error("No build artifacts found");
}
let body = "Download the build artifacts for this pull request:";
for (let artifact of artifacts) {
body += `\n* [${artifact.name}](https://nightly.link/${owner}/${repo}/actions/artifacts/${artifact.id}.zip)`;
}
const { data: comments } = await github.rest.issues.listComments({repo, owner, issue_number});
const existing_comment = comments.find((comment) => comment.user.login === 'github-actions[bot]');
if (existing_comment) {
core.info(`Updating existing comment ${existing_comment.id}`);
await github.rest.issues.updateComment({repo, owner, comment_id: existing_comment.id, body});
} else {
core.info("Creating a new comment");
await github.rest.issues.createComment({repo, owner, issue_number, body});
}
36 changes: 0 additions & 36 deletions .github/workflows/publish-to-releases.yml

This file was deleted.

14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ The Windows build also comes with an auto update feature.
### Windows

#### Install
Download the `RyuSAK-win32-x64-X.Y.Z-installer.exe` file, then install it by running the installer
Download the `RyuSAK-X.Y.Z Setup.exe` file, then install it by running the installer

#### Portable
Download the `RyuSAK-win32-x64-X.Y.Z-portable.zip` file, then unzip it to your chosen location
Download the `RyuSAK-win32-x64-X.Y.Z.zip` file, then unzip it to your chosen location

### Linux

Expand All @@ -31,6 +31,9 @@ Download the `ryusak_X.Y.Z_amd64.deb` file, then install it with `sudo dpkg -i .
#### Red Hat Linux
Download the `RyuSAK-X.Y.Z-1.x86_64.rpm` file, then install it with `sudo rpm -i /RyuSAK-X.Y.Z-1.x86_64.rpm`

#### Portable
Download the `RyuSAK-linux-x64-X.Y.Z.zip` file, then unzip it to your chosen location

## Features
* Add one or multiple Ryujinx folders (where `Ryujinx.exe` is located) to manage different builds (such as mainline, portable, LDN, etc.)
* List your game library
Expand All @@ -46,12 +49,15 @@ Download the `RyuSAK-X.Y.Z-1.x86_64.rpm` file, then install it with `sudo rpm -i
Requirements:
* NodeJS v14+

Install & run:
Install dependencies:
```
npm install --include=dev
npm start
npm run tinfoil
npm run eshop
```

Run local build: `npm start`

## Credits
* CapitaineJSparrow for creating the original [emusak-ui](https://github.com/CapitaineJSparrow/emusak-ui) project
* Ecchibitionist for hosting the firmware, saves, shaders and mods on his CDN
64 changes: 7 additions & 57 deletions forge.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const fs = require("fs-extra");
const path = require("path");
const Zip = require("adm-zip");

module.exports = {
Expand All @@ -8,17 +7,6 @@ module.exports = {
"icon": "./icon.ico",
"executableName": "RyuSAK"
},
"publishers": [
{
"name": "@electron-forge/publisher-github",
"config": {
"repository": {
"owner": "Ecks1337",
"name": "RyuSAK"
}
}
}
],
"makers": [
{
"name": "@electron-forge/maker-squirrel",
Expand All @@ -27,19 +15,13 @@ module.exports = {
}
},
{
"name": "@electron-forge/maker-zip",
"platforms": [
"win32"
]
"name": "@electron-forge/maker-zip"
},
{
"name": "@electron-forge/maker-deb"
},
{
"name": "@electron-forge/maker-rpm"
},
{
"name": "@electron-forge/maker-flatpak"
}
],
"plugins": [
Expand All @@ -62,47 +44,15 @@ module.exports = {
],
"hooks": {
"postMake": async (_, makeResults) => {
const version = makeResults[0].packageJSON.version;
const portablePath = makeResults.map(b => b.artifacts).flat().find(i => i.includes(".zip") && i.includes("win32"));
const exePath = makeResults.map(b => b.artifacts).flat().find(i => i.includes("Setup.exe"));
const zipPath = makeResults.map(result => result.artifacts).flat().find(path => path.endsWith(".zip"));

if (portablePath) {
const filename = path.basename(portablePath);
await fs.move(portablePath, portablePath.replace(filename, `RyuSAK-win32-x64-${version}-portable.zip`));
}
if (zipPath) {
const zip = new Zip(zipPath);
zip.addFile("portable", Buffer.from("portable", "utf8"));

if (exePath) {
const filename = path.basename(exePath);
await fs.move(exePath, exePath.replace(filename, `RyuSAK-win32-x64-${version}-installer.exe`));
fs.removeSync(zipPath);
zip.writeZip(zipPath);
}

return makeResults.map(r => ({
...r,
...{
artifacts:
r.artifacts.map(fullPath => {
const filename = path.basename(fullPath);

if (fullPath.includes(".zip") && fullPath.includes("win32")) {
const zipPath = fullPath.replace(filename, `RyuSAK-win32-x64-${version}-portable.zip`);

const archive = new Zip(zipPath);
archive.addFile("portable", Buffer.from("portable", "utf8"));

fs.removeSync(zipPath);
archive.writeZip(zipPath);

return zipPath;
}

if (fullPath.includes(".exe")) {
return fullPath.replace(filename, `RyuSAK-win32-x64-${version}-installer.exe`);
}

return fullPath;
})
}
}));
}
}
};
Loading

0 comments on commit 54595c3

Please sign in to comment.