Skip to content

Commit

Permalink
testing NEUROGLANCER_BUILD_INFO in esbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisj committed Aug 16, 2023
1 parent 26db4aa commit 1fca3e8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ jobs:
- name: Typecheck with TypeScript
run: npm run typecheck
- name: Get build info
run: |
build_info="{'tag':'$(git describe --always --tags)', 'url':'https://github.com/${{github.repository}}/commit/$(git rev-parse HEAD)', 'timestamp':'$(date)'}"
echo $build_info
echo $build_info > src/version.json
run: echo "BUILD_INFO={'tag':'$(git describe --always --tags)', 'url':'https://github.com/${{github.repository}}/commit/$(git rev-parse HEAD)', 'timestamp':'$(date)'}" >> $GITHUB_ENV
shell: bash
- name: Write build info
run: echo ${{ env.BUILD_INFO }} >> src/version.json
shell: bash
- name: Build client bundles
run: node ./config/esbuild-cli.js --config=min --no-typecheck --define STATE_SERVERS=$(cat config/state_servers.json | tr -d " \t\n\r")
run: node ./config/esbuild-cli.js --config=min --no-typecheck --define STATE_SERVERS=$(cat config/state_servers.json | tr -d " \t\n\r") --define NEUROGLANCER_BUILD_INFO="${{ env.BUILD_INFO }}"
- run: cp -r ./dist/min appengine/frontend/static/
- name: Get branch name (merge)
if: github.event_name != 'pull_request'
Expand Down
5 changes: 5 additions & 0 deletions config/esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
`;

await fs.promises.writeFile(path.resolve(this.outDir, 'index.html'), indexHtml);

if (typeof NEUROGLANCER_BUILD_INFO !== 'undefined') {
console.log("NEUROGLANCER_BUILD_INFO", NEUROGLANCER_BUILD_INFO);
await fs.promises.writeFile(path.resolve(this.outDir, 'wehavebuildinfo.json'), NEUROGLANCER_BUILD_INFO);
}
}

getBaseEsbuildConfig() {
Expand Down

0 comments on commit 1fca3e8

Please sign in to comment.