diff --git a/.github/workflows/release-ui-assets.yaml b/.github/workflows/release-ui-assets.yaml index ff02b9715f..c5564684ea 100644 --- a/.github/workflows/release-ui-assets.yaml +++ b/.github/workflows/release-ui-assets.yaml @@ -15,6 +15,9 @@ jobs: - uses: actions/setup-node@v1 with: node-version: '12.x' + - uses: actions/setup-go@v1 + with: + go-version: '1.13.5' - name: Lookup yarn cache id: yarn_cache run: echo "::set-output name=dir::$(yarn cache dir)" @@ -24,24 +27,19 @@ jobs: key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- - - name: Install dependencies - working-directory: ui - run: | - yarn install --frozen-lockfile - - name: Build project - working-directory: ui + - name: Build UI run: | - yarn build - - name: Pack release assets + make ui_for_pd + - name: Pack UI asset release working-directory: ui/build run: | zip -r ../static-assets.zip . - - name: Lookup release version + - name: Lookup asset release version id: lookup_release_version working-directory: ui run: | echo "::set-output name=release_version::$(grep -v '^#' .github_release_version)" - - name: Create release + - name: Create asset release id: create_release uses: actions/create-release@v1 env: @@ -51,7 +49,7 @@ jobs: release_name: UI Release ${{ steps.lookup_release_version.outputs.release_version }} draft: false prerelease: false - - name: Upload release assets + - name: Upload asset release uses: actions/upload-release-asset@v1.0.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -60,3 +58,19 @@ jobs: asset_path: ./ui/static-assets.zip asset_name: static-assets.zip asset_content_type: application/zip + - name: Generate embedded assets + run: | + scripts/embed_ui_assets.sh + cp pkg/uiserver/embedded_assets_handler.go embedded_assets_handler.go + - name: Pack embedded assets + run: | + zip -r embedded-assets-golang.zip ./embedded_assets_handler.go + - name: Upload embedded asset release + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./embedded-assets-golang.zip + asset_name: embedded-assets-golang.zip + asset_content_type: application/zip diff --git a/Makefile b/Makefile index b8bd483fbf..cce23a88e6 100644 --- a/Makefile +++ b/Makefile @@ -16,18 +16,24 @@ default: tidy: go mod tidy -swagger: - scripts/generate_swagger.sh +swagger_spec: + scripts/generate_swagger_spec.sh -swagger_client: swagger - cd ui && yarn && npm run build_api_client +yarn_dependencies: + cd ui && yarn install --frozen-lockfile + +swagger_client: swagger_spec yarn_dependencies + cd ui && npm run build_api_client ui: swagger_client - cd ui && yarn && REACT_APP_DASHBOARD_API_URL="" npm run build + cd ui && REACT_APP_DASHBOARD_API_URL="" npm run build + +ui_for_pd: swagger_client + cd ui && REACT_APP_DASHBOARD_API_URL="/dashboard" npm run build server: ifeq ($(SWAGGER),1) - make swagger + make swagger_spec endif ifeq ($(UI),1) scripts/embed_ui_assets.sh diff --git a/scripts/generate_swagger.sh b/scripts/generate_swagger_spec.sh similarity index 100% rename from scripts/generate_swagger.sh rename to scripts/generate_swagger_spec.sh diff --git a/ui/.github_release_version b/ui/.github_release_version index 789f731510..8e5567b229 100644 --- a/ui/.github_release_version +++ b/ui/.github_release_version @@ -1,3 +1,3 @@ # This file contains a version number which will be used to release assets to # GitHub. To trigger a new asset release, simply increase this version number. -20200103_1 +20200106_1