Skip to content

Commit e5bc120

Browse files
authored
Release 0.1.1 and general upkeep (#13)
1. Release 0.1.1 with nexe 4.0.0-beta.19 and node versions 12.21.0, 12.22.6, 14.16.0, 14.18.0, 16.11.0 2. Updated all Node package dependency versions. 3. Updated all GitHub Actions versions. 4. Fixed build bug of not creating `./RELEASE_ID` file for new release versions. 5. Added documentation on script calls.
1 parent 552b275 commit e5bc120

10 files changed

+2298
-114
lines changed

.github/workflows/nexe-cd.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ jobs:
1616
shell: bash
1717
strategy:
1818
matrix:
19-
os: [ubuntu-18.04, windows-latest, macos-latest]
20-
node_version: ['12.21.0', '14.16.0']
19+
os: [ubuntu-latest, windows-latest, macos-latest]
20+
node_version: ['12.21.0', '12.22.6', '14.16.0', '14.18.0', '16.11.0']
2121

2222
steps:
2323
- uses: actions/checkout@v2
2424
- name: Get node details via .npmrc
2525
id: get_node_details
2626
run: echo "::set-output name=version::$(cat .nvmrc)"
2727
- name: Use Node.js from .nvmrc
28-
uses: actions/setup-node@v2.1.5
28+
uses: actions/setup-node@v2.4.1
2929
with:
3030
node-version: ${{ steps.get_node_details.outputs.version }}
3131
- name: Declare caches for build
32-
uses: actions/cache@v2
32+
uses: actions/cache@v2.1.4
3333
with:
3434
path: |
3535
~/.ccache/

.github/workflows/nexe-ci.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ jobs:
1616
shell: bash
1717
strategy:
1818
matrix:
19-
os: [ubuntu-18.04, windows-latest, macos-latest]
20-
node_version: ['12.21.0', '14.16.0']
19+
os: [ubuntu-latest, windows-latest, macos-latest]
20+
node_version: ['12.21.0', '12.22.6', '14.16.0', '14.18.0', '16.11.0']
2121

2222
steps:
2323
- uses: actions/checkout@v2
2424
- name: Get node details via .npmrc
2525
id: get_node_details
2626
run: echo "::set-output name=version::$(cat .nvmrc)"
2727
- name: Use Node.js from .nvmrc
28-
uses: actions/setup-node@v2.1.5
28+
uses: actions/setup-node@v2.4.1
2929
with:
3030
node-version: ${{ steps.get_node_details.outputs.version }}
3131
- name: Declare caches for build
32-
uses: actions/cache@v2
32+
uses: actions/cache@v2.1.4
3333
with:
3434
path: |
3535
~/.ccache/

README.md

+49-3
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
# Nexe Builds
22

3-
> Current version `0.1.0`. Current remote URL: `https://github.com/urbdyn/nexe_builds/releases/download/0.1.0/`
3+
> Current version `0.1.1`. Current remote URL: `https://github.com/urbdyn/nexe_builds/releases/download/0.1.1/`
44
55
[Nexe] is a fantastic tool for turning Node.js applications into single binaries.
66
This repository provides automation to pre-build and distribute the node binaries, so you don't have to!
77

88

99
## How to Use
1010

11-
To use the pre-built binaries with nexe just add `--remote https://github.com/urbdyn/nexe_builds/releases/download/0.1.0/`
11+
To use the pre-built binaries with nexe just add `--remote https://github.com/urbdyn/nexe_builds/releases/download/0.1.1/`
1212

1313
Script example:
1414

1515
```bash
1616
# Install Nexe
1717
npm install nexe
1818
# Save remote URL as variable
19-
NEXE_REMOTE="https://github.com/urbdyn/nexe_builds/releases/download/0.1.0/"
19+
NEXE_REMOTE="https://github.com/urbdyn/nexe_builds/releases/download/0.1.1/"
2020
# Do nexe build
2121
npx nexe ./myScript.js --remote "$NEXE_REMOTE"
2222
```
@@ -42,3 +42,49 @@ Urban Dynamics makes use of [Nexe](https://github.com/nexe/nexe) for a number of
4242
It's a great tool but the pre-built binaries are becoming a bit stale compared to the Node.js release schedule.
4343
So, we decided to open source our build automation which was creating and publishing prebuilt binaries.
4444
Enjoy 🚀
45+
46+
## Build Call Flow
47+
48+
1. `bin/run_cd`: Gets the prior git commit, calls `bin/check_assets`, and then calls `bin/install_dependencies` plus `bin/build_nexe` if a build is needed.
49+
1. Args: None
50+
2. Environmental Variables:
51+
1. `NODE_VERSION`: Version of Node.js to build for. [required]
52+
2. `CREATE_RELEASE`: Whether to actually do the compilation or dry run. [optional]
53+
3. Files created:
54+
1. Those created by scripts invoked (see below).
55+
4. Exit codes:
56+
1. `0`: Success
57+
2. `1`: `check_asset` script failed.
58+
3. `2`: `install_dependencies` script failed.
59+
4. `3`: `build_nexe` script failed.
60+
2. `bin/check_assets`: Checks if target build has been published and lazily creates release if it doesn't exist.
61+
1. Args:
62+
1. Node.js version to target.
63+
2. Repo commit to create release for.
64+
3. `--no-create-release` flag (optional)
65+
2. Environmental Variables:
66+
1. `GITHUB_TOKEN`: Token to use for querying github and creating release if needed. [required]
67+
3. Files created:
68+
1. `$repo_base/NEXE_ASSET_NAME`: Name of the nexe asset to create. (integer)
69+
2. `$repo_base/RELEASE_ID`: The ID of the Github Release to publish assets to. (`${targetOs}-${targetArch}-${targetNodeVersion}`)
70+
4. Exit codes:
71+
1. `0`: Build not needed
72+
2. `1`: Error occurred
73+
3. `10`: Build needed.
74+
2. `bin/install_dependencies`: Installs proper dependencies for each OS.
75+
1. Args: None
76+
2. Environmental Variables: None
77+
3. Files created: None
78+
4. Exit codes:
79+
1. `0`: Success
80+
2. `*`: Failure
81+
3. `bin/build_nexe`: Performs nexe build based on given node version.
82+
1. Args:
83+
1. Command (`build` or `build-check`)
84+
2. Node.js version to build for.
85+
2. Environmental Variables: None
86+
3. Files created:
87+
1. Nexe build artifact (`$repo_dir/dist/$os_env-$os_arch-$node_target`)
88+
4. Exit codes:
89+
1. `0`: Success
90+
2. `*`: Failure

RELEASE_LOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# urbdyn/nexe_builds release log
22

3+
## 0.1.1
4+
5+
* Created on: 2021-10-10
6+
* Nexe version: 4.0.0-beta.19
7+
* Initial release.
8+
* Build matrix:
9+
* OS: `linux`, `macos`, `windows`
10+
* Node Version: `12.21.0`, `12.22.6`, `14.16.0`, `14.18.0`, `16.11.0`
11+
312
## 0.1.0
413

514
* Created on: 2021-03-17

bin/build_nexe

+4-2
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,15 @@ function main(){
9393
nexe_cmd="$nexe_cmd -o $nexe_no_mangle_path '$repo_dir/index.js'"
9494

9595
echo "console.log()" > "$repo_dir/index.js"
96-
echo "Building $nexe_no_mange_name"
96+
echo "Building $nexe_no_mangle_name"
9797
echo " $nexe_cmd"
9898
time npx $nexe_cmd
9999
rm "$repo_dir/index.js"
100+
# Not compressing right now because nexe currently doesn't support downloading
101+
# compressed prebuilt binaries.
100102
#echo "Compressing outputted file ..."
101103
#cd "$build_dir"
102-
#gzip -1 "./$nexe_no_mange_name"
104+
#gzip -1 "./$nexe_no_mangle_name"
103105
;;
104106
*)
105107
echo "Command is not supported: $cmd"

bin/check_asset

+13-5
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ async function main() {
7070
console.log(`nexeAssetName = ${nexeAssetName}`);
7171

7272
console.log(`Writing nexe asset name (${nexeAssetName}) to file: NEXE_ASSET_NAME`);
73-
const releaseIdPath = path.join(__dirname, '../NEXE_ASSET_NAME');
74-
fs.writeFileSync(releaseIdPath, nexeAssetName);
73+
const assetNamePath = path.join(__dirname, '../NEXE_ASSET_NAME');
74+
fs.writeFileSync(assetNamePath, nexeAssetName);
7575

7676
// Generate asset data
7777
const assetData = genAssetData(packageData.version, targetOs);
@@ -98,14 +98,16 @@ async function main() {
9898
const existingAsset = releaseAssetsNames.includes(nexeAssetName);
9999
if (existingAsset) {
100100
console.log(`Existing asset found: ${existingAsset}`);
101-
console.log(`Build NOT needed. Exiting cleanly.`)
101+
console.log(`Build NOT needed. Exiting cleanly.`);
102102
process.exit(0);
103103
} else {
104104
console.log(`Existing asset NOT found.`);
105-
console.log(`Build needed! Exiting with error code 10.`)
105+
console.log(`Build needed! Exiting with error code 10.`);
106106
process.exit(10);
107107
}
108108
} else {
109+
let releaseId = 'none'; // Default to none unless release is created
110+
109111
console.log(`No existing release version '${packageData.version}' found.`);
110112
console.log(`Creating release '${packageData.version}' ...`)
111113
const releaseBody = `Release of pre-built nexe binaries using nexe version: ${nexeVersion}`;
@@ -122,10 +124,16 @@ async function main() {
122124
);
123125
console.log('Release created.');
124126
console.log(createResponse);
127+
releaseId = createResponse.id;
125128
} else {
126129
console.log('Skipping creating release due to --no-create-release flag.');
127130
}
128-
console.log(`Build needed! Exiting with error code 10.`)
131+
132+
console.log(`Writing new release ID (${releaseId}) to file: RELEASE_ID`);
133+
const releaseIdPath = path.join(__dirname, '../RELEASE_ID');
134+
fs.writeFileSync(releaseIdPath, 'none');
135+
136+
console.log(`Build needed! Exiting with error code 10.`);
129137
process.exit(10);
130138
}
131139

bin/install_dependencies

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ case "$os_env" in
1919
sudo apt-get install -y ccache
2020
set +x
2121
;;
22-
# Temporarily disabling to see if build works
22+
# Temporarily disabling as it was causing build to fail for unknown reasons
2323
#"macos")
2424
# echo "Installing macos dependencies ..."
2525
# set -x

bin/run_cd

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ case "$exit_code" in
3434
;;
3535
"10")
3636
echo "Running: bin/install_dependencies"
37-
$script_dir/install_dependencies
37+
$script_dir/install_dependencies || exit 2
3838
echo "Running: bin/build_nexe build $NODE_VERSION"
39-
$script_dir/build_nexe build "$NODE_VERSION"
39+
$script_dir/build_nexe build "$NODE_VERSION" || exit 3
4040
;;
4141
*)
42-
echo "Error exit code detected ($exit_code)! Crashing."
42+
echo "Error exit code detected ($exit_code) from check_asset script! Crashing."
4343
exit 1
4444
;;
4545
esac

0 commit comments

Comments
 (0)