mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-22 21:51:39 +03:00
feat: add hubspot embed script
This commit is contained in:
parent
a26ff35a7b
commit
d77052ee1b
87
.github/workflows/livedemo.yml
vendored
Normal file
87
.github/workflows/livedemo.yml
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
name: Build AFFiNE-Local
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
# pull_request:
|
||||
# branches: [master]
|
||||
|
||||
# Cancels all previous workflow runs for pull requests that have not completed.
|
||||
# See https://docs.github.com/en/actions/using-jobs/using-concurrency
|
||||
concurrency:
|
||||
# The concurrency group contains the workflow name and the branch name for
|
||||
# pull requests or the commit hash for any other events.
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
NAMESPACE: toeverything
|
||||
AFFINE_IMAGE_NAME: LIVEDEMO
|
||||
IMAGE_TAG_LATEST: nightly-latest
|
||||
LOCAL_CACHE: localhost:5000/toeverything/relocate:latest
|
||||
|
||||
jobs:
|
||||
ligo-virgo:
|
||||
runs-on: self-hosted
|
||||
environment: development
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
services:
|
||||
registry:
|
||||
image: registry:2
|
||||
ports:
|
||||
- 5000:5000
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
driver-opts: network=host
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker (AFFiNE-Local)
|
||||
id: meta_affine
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.AFFINE_IMAGE_NAME }}
|
||||
tags: ${{ env.IMAGE_TAG_LATEST }}
|
||||
|
||||
- name: Build and push Docker image (AFFINE-Local)
|
||||
uses: docker/build-push-action@v3
|
||||
env:
|
||||
HUBSPOT_API_SECRET: ${{ secrets.SuperSecret }}
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
file: ./.github/deployment/Dockerfile-affine
|
||||
tags: ${{ env.LOCAL_CACHE }}
|
||||
target: AFFiNE
|
||||
|
||||
- name: Build and push Docker image (AFFINE-Local)
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64/v8
|
||||
file: ./.github/deployment/Dockerfile-affine-multiplatform
|
||||
push: ${{ github.ref == 'refs/heads/master' && true || false }}
|
||||
tags: ${{ steps.meta_affine.outputs.tags }}
|
||||
labels: ${{ steps.meta_affine.outputs.labels }}
|
||||
target: AFFiNE
|
||||
build-args: |
|
||||
BASE_IMAGE=${{ env.LOCAL_CACHE }}
|
@ -4,6 +4,7 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
<%= htmlWebpackPlugin.options.hubspotScript %>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
@ -12,6 +12,13 @@ const Style9Plugin = require('style9/webpack');
|
||||
|
||||
const enableBundleAnalyzer = process.env.BUNDLE_ANALYZER;
|
||||
|
||||
function generateHubspotScript() {
|
||||
const hubspotApiSecret = process.env.HUBSPOT_API_SECRET;
|
||||
if (hubspotApiSecret) {
|
||||
return `<script type="text/javascript" id="hs-script-loader" async defer src="//js-na1.hs-scripts.com/${hubspotApiSecret}.js"></script>`;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function (webpackConfig) {
|
||||
const config = getNxWebpackConfig(webpackConfig);
|
||||
|
||||
@ -175,6 +182,7 @@ module.exports = function (webpackConfig) {
|
||||
), //favicon path
|
||||
template: path.resolve(__dirname, './src/template.html'),
|
||||
publicPath: '/',
|
||||
hubspotScript: generateHubspotScript(),
|
||||
}),
|
||||
new Style9Plugin(),
|
||||
isProd &&
|
||||
|
Loading…
Reference in New Issue
Block a user