diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml new file mode 100644 index 00000000..cd068838 --- /dev/null +++ b/.github/workflows/examples.yml @@ -0,0 +1,60 @@ +name: Build and deploy examples +on: [push, pull_request] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + # cache: 'yarn' + + - name: Install Yarn + run: npm install -g yarn + - name: Cache node modules + uses: actions/cache@v3 + with: + path: node_modules + key: yarn-deps-${{ hashFiles('yarn.lock') }} + restore-keys: | + yarn-deps-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - name: Build libraries + run: yarn build + + - name: Build example playgrounds + run: yarn build:playgrounds + + - uses: vimtor/action-zip@v1.1 + with: + dest: github-pages + files: | + examples/index.html + examples/demo/dist/ + examples/js-demo/dist/ + examples/templating/dist/ + + # - name: Fix permissions + # run: | + # chmod -v -R +rX "_site/" | while read line; do + # echo "::warning title=Invalid file permissions automatically fixed::$line" + # done + + - name: Upload pages artifacts + uses: actions/upload-pages-artifact@v2 + + deploy: + needs: build + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v3 diff --git a/examples/index.html b/examples/index.html new file mode 100644 index 00000000..516b2727 --- /dev/null +++ b/examples/index.html @@ -0,0 +1,161 @@ + + + + + + Algolia Recommend | Examples + + + + +
+
+

+ + Algolia Recommend Logo + + + + + + Algolia Recommend Examples +

+
+ + +
+ + diff --git a/package.json b/package.json index 1b3207c2..31f59521 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "playground-js:start": "yarn workspace @algolia/recommend-js-example start", "playground-templating:start": "yarn workspace @algolia/recommend-templating-example start", "playground:start": "yarn workspace @algolia/recommend-react-example start", + "build:playgrounds": "lerna run build --scope=\"'@algolia/recommend-*-example'\"", "prepare": "lerna run prepare --no-private", "release": "shipjs prepare", "test:size": "bundlesize",