From a672391b53db001791ba29068e76019cf0a1061c Mon Sep 17 00:00:00 2001 From: Jeremy Maitin-Shepard Date: Mon, 18 Mar 2024 01:35:06 -0700 Subject: [PATCH] chore: publish client to firebase hosting automatically --- .github/workflows/build.yml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 72748825a..98aa532dd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,9 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 + with: + # Need full history to determine version number. + fetch-depth: 0 - uses: actions/setup-node@v4 with: node-version: 20.x @@ -34,7 +37,10 @@ jobs: - name: Typecheck with TypeScript run: npm run typecheck - name: Build client bundles - run: npm run build -- --no-typecheck --no-lint + run: | + build_info="{'tag':'$(git describe --always --tags)', 'url':'https://github.com/google/neuroglancer/commit/$(git rev-parse HEAD)', 'timestamp':'$(date)'}" + npm run build -- --no-typecheck --no-lint --define NEUROGLANCER_BUILD_INFO="${build_info}" + shell: bash - name: Build Python client bundles run: npm run build-python -- --no-typecheck --no-lint - run: npm run build-package @@ -51,6 +57,12 @@ jobs: name: npm-package path: dist/package if: ${{ runner.os == 'Linux' }} + - name: Upload client as artifact + uses: actions/upload-artifact@v4 + with: + name: client + path: dist/client + if: ${{ runner.os == 'Linux' }} # Builds Python package and runs Python tests # @@ -183,6 +195,10 @@ jobs: with: name: npm-package path: npm-package + - uses: actions/download-artifact@v4 + with: + name: client + path: dist/client # - name: Publish to PyPI (test server) # uses: pypa/gh-action-pypi-publish@54b39fb9371c0b3a6f9f14bb8a67394defc7a806 # 2020-09-25 # with: @@ -201,6 +217,13 @@ jobs: # working-directory: npm-package # env: # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Publish to Firebase hosting + uses: FirebaseExtended/action-hosting-deploy@v0 + with: + firebaseServiceAccount: "${{ secrets.FIREBASE_HOSTING_SERVICE_ACCOUNT_KEY }}" + projectId: neuroglancer-demo + if: ${{ startsWith(github.ref, 'refs/tags/v') }} + ngauth: strategy: matrix: