Skip to content

Commit

Permalink
added verion.json
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisj committed Nov 18, 2023
1 parent b850784 commit d2b3dfc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ jobs:
- run: npm install
- name: Typecheck with TypeScript
run: npm run typecheck
- 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: cp -r ./dist/min appengine/frontend/static/
- name: Get branch name (merge)
if: github.event_name != 'pull_request'
shell: bash
Expand All @@ -38,6 +35,15 @@ jobs:
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
- run: echo "BRANCH_NAME_URL=$(echo ${{ env.BRANCH_NAME }} | tr / - | tr _ -)" >> $GITHUB_ENV
- name: Get build info
run: echo "BUILD_INFO={'tag':'$(git describe --always --tags)', 'url':'https://github.com/${{github.repository}}/commit/$(git rev-parse HEAD)', 'timestamp':'$(date)', 'branch':'${{github.repository}}/${{env.BRANCH_NAME}}'}" >> $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") --define NEUROGLANCER_BUILD_INFO="${{ env.BUILD_INFO }}"
- run: cp -r ./dist/min appengine/frontend/static/
- name: start deployment
uses: bobheadxi/deployments@v1
id: deployment
Expand Down
10 changes: 10 additions & 0 deletions config/esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ 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);
}

async writeInfo() {
if (this.define.NEUROGLANCER_BUILD_INFO) {
await fs.promises.writeFile(path.resolve(this.outDir, 'version.json'), this.define.NEUROGLANCER_BUILD_INFO);
}
if (this.define.STATE_SERVERS) {
await fs.promises.writeFile(path.resolve(this.outDir, 'state_servers.json'), this.define.STATE_SERVERS);
}
}

getBaseEsbuildConfig() {
return {
outdir: this.outDir,
Expand Down Expand Up @@ -187,6 +196,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=

async buildNonModule() {
await this.writeIndex();
await this.writeInfo();
if (!this.python) {
await fs.promises.copyFile(
path.resolve(this.srcDir, 'neuroglancer/datasource/boss/bossauth.html'),
Expand Down

0 comments on commit d2b3dfc

Please sign in to comment.