Skip to content

Commit

Permalink
Use compiled file instead of link on release
Browse files Browse the repository at this point in the history
  • Loading branch information
tmattio committed May 18, 2020
1 parent c3b5358 commit 57df00e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
ocaml-version: ${{ matrix.ocaml-version }}

- name: Use Node.js 12.x
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/setup-node@v1
with:
node-version: 12.x
Expand All @@ -35,7 +36,7 @@ jobs:
run: opam depext -yt spin

- name: Install dependencies
run: make dev
run: opam install --deps-only -y .

- name: Substitute watermarks
run: opam exec -- dune subst
Expand All @@ -58,7 +59,7 @@ jobs:
uses: actions/upload-artifact@master
with:
name: ${{ matrix.os }}
path: _build/install/default/bin/spin
path: _build/default/bin/main.exe

publish:
needs: build
Expand Down
24 changes: 10 additions & 14 deletions script/release-postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ const fs = require("fs");

const platform = process.platform;

const binariesToCopy = [
"spin"
];
const binaryName = "main.exe";

function find_arch() {
// The running binary is 64-bit, so the OS is clearly 64-bit.
Expand Down Expand Up @@ -57,18 +55,16 @@ function copyFileSync(sourcePath, destPath) {
fs.chmodSync(destPath, stat.mode);
}

const copyPlatformBinaries = platformPath => {
const copyPlatformBinary = platformPath => {
const platformBuildPath = path.join(__dirname, platformPath);

binariesToCopy.forEach(binaryPath => {
const sourcePath = path.join(platformBuildPath, binaryPath);
const destPath = path.join(__dirname, binaryPath);
if (fs.existsSync(destPath)) {
fs.unlinkSync(destPath);
}
copyFileSync(sourcePath, destPath);
fs.chmodSync(destPath, 0o755);
});
const sourcePath = path.join(platformBuildPath, binaryName);
const destPath = path.join(__dirname, "spin");
if (fs.existsSync(destPath)) {
fs.unlinkSync(destPath);
}
copyFileSync(sourcePath, destPath);
fs.chmodSync(destPath, 0o755);
};

const arch = find_arch();
Expand All @@ -86,4 +82,4 @@ if (!supported) {
process.exit(1);
}

copyPlatformBinaries(platformPath);
copyPlatformBinary(platformPath);

0 comments on commit 57df00e

Please sign in to comment.