Skip to content
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.

Commit

Permalink
fix: remeshes CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsSim committed Jan 23, 2024
1 parent 38cb6bb commit 884701e
Showing 1 changed file with 51 additions and 44 deletions.
95 changes: 51 additions & 44 deletions .github/workflows/electron_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,39 @@ on:
- develop

jobs:
build-and-publish:
build-remeshes:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16

- name: Build Remeshes
run: |
npm install
npm run build
working-directory: other/fsolauncher-remeshes

- name: Calculate SHA256 hash of Remeshes
run: |
hash=$(shasum -a 256 release/remeshes-*.zip | awk '{print $1}')
echo "Remeshes hash: $hash"
echo $hash > release/sha256_remeshes.txt
working-directory: other/fsolauncher-remeshes

- name: Upload Remeshes as Artifact
uses: actions/upload-artifact@v2
with:
name: remeshes-zip
path: |
other/fsolauncher-remeshes/release/remeshes-*.zip
other/fsolauncher-remeshes/release/sha256_remeshes.txt
build-launcher:
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down Expand Up @@ -47,41 +79,6 @@ jobs:
with:
node-version: 16

- name: Build Remeshes
run: |
npm install
npm run build
working-directory: other/fsolauncher-remeshes

- name: Get Remeshes Version
id: get_remeshes_version
shell: bash
run: |
echo "REMESHES_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
working-directory: other/fsolauncher-remeshes

- name: Calculate SHA256 hash of Remeshes (Windows)
if: matrix.os == 'windows-latest'
run: |
$hash = (Get-FileHash -Path "release/remeshes-*.zip" -Algorithm SHA256).Hash.ToLower()
echo "Windows hash: $hash"
echo $hash > release/sha256_remeshes.txt
- name: Calculate SHA256 hash of Remeshes (macOS)
if: matrix.os == 'macos-latest'
run: |
hash=$(shasum -a 256 release/remeshes-*.zip | awk '{print $1}')
echo "macOS hash: $hash"
echo $hash > release/sha256_remeshes.txt
- name: Upload Remeshes as Artifact
uses: actions/upload-artifact@v2
with:
name: remeshes-zip
path: |
release/remeshes-*.zip
release/sha256_remeshes.txt
- name: Cache Electron binaries
id: cache-electron-binaries
uses: actions/cache@v2
Expand Down Expand Up @@ -173,7 +170,7 @@ jobs:
release/sha256_darwin.txt
create-release:
needs: build-and-publish
needs: [build-launcher, build-remeshes]
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -272,20 +269,30 @@ jobs:
name: remeshes-zip
path: release/remeshes

- name: Find Remeshes File
id: find_remeshes_file
run: |
remeshes_file=$(ls release/remeshes/remeshes-*.zip)
echo "REMESHES_FILE=$remeshes_file" >> $GITHUB_ENV
echo "Found remeshes file: $remeshes_file"
- name: Upload release assets
uses: actions/github-script@v5
with:
script: |
const fs = require('fs');
const launcherVersion = process.env.FULL_VERSION_NAME;
const remeshesVersion = process.env.REMESHES_VERSION;
const launcherNameWindows = `fsolauncher-${launcherVersion}.exe`;
const launcherNameMac = `fsolauncher-${launcherVersion}.dmg`;
const remeshesFile = process.env.REMESHES_FILE;
const remeshesName = remeshesFile.split('/').pop();
const assetPaths = [
{path: 'release/win/FreeSO Launcher Setup.exe', name: `fsolauncher-${launcherVersion}.exe`, contentType: 'application/octet-stream'},
{path: 'release/win/sha256_win32.txt', name: `fsolauncher-${launcherVersion}.exe.sha256`, contentType: 'text/plain'},
{path: 'release/mac/FreeSO Launcher.dmg', name: `fsolauncher-${launcherVersion}.dmg`, contentType: 'application/octet-stream'},
{path: 'release/mac/sha256_darwin.txt', name: `fsolauncher-${launcherVersion}.dmg.sha256`, contentType: 'text/plain'},
{path: `release/remeshes/remeshes-${remeshesVersion}.zip`, name: `remeshes-${remeshesVersion}.zip`, contentType: 'application/zip'},
{path: 'release/remeshes/sha256_remeshes.txt', name: `remeshes-${remeshesVersion}.zip.sha256`, contentType: 'text/plain'},
{path: 'release/win/FreeSO Launcher Setup.exe', name: launcherNameWindows, contentType: 'application/octet-stream'},
{path: 'release/win/sha256_win32.txt', name: launcherNameWindows + '.sha256', contentType: 'text/plain'},
{path: 'release/mac/FreeSO Launcher.dmg', name: launcherNameMac, contentType: 'application/octet-stream'},
{path: 'release/mac/sha256_darwin.txt', name: launcherNameMac + '.sha256', contentType: 'text/plain'},
{path: remeshesFile, name: remeshesName, contentType: 'application/zip'},
{path: 'release/remeshes/sha256_remeshes.txt', name: remeshesName + '.sha562', contentType: 'text/plain'},
];
const release = await github.rest.repos.getReleaseByTag({
Expand Down

0 comments on commit 884701e

Please sign in to comment.