Skip to content

add npm install

add npm install #2

name: PR To GitHub Page Repo
on:
push:
branches:
- react-website
jobs:
send-pull-requests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Bundle
run: |
npm i
npm run build
- name: copy Bundle
run: |
mkdir -p $GITHUB_WORKSPACE/artifact
cp dist/*.wasm $GITHUB_WORKSPACE/artifact
cp dist/*.js $GITHUB_WORKSPACE/artifact
cp dist/*.txt $GITHUB_WORKSPACE/artifact
ls $GITHUB_WORKSPACE/artifact >> $GITHUB_STEP_SUMMARY
- name: Send pull-request
run: |
REPOSITORY="partiql/partiql.github.io"
FOLDER="bin/$REPOSITORY"
BRANCH_NAME="Update-Playground"
# Clone the remote repository and change working directory to the
# folder it was cloned to.
git clone \
--depth=1 \
--branch=main \
https://github.com/partiql/partiql.github.io.git \
$FOLDER
cd $FOLDER
# Setup the committers identity.
git config user.email "[email protected]"
git config user.name "PartiQL Team"
# Create a new feature branch for the changes.
git checkout -b $BRANCH_NAME
# Remove Static Folder
rm -rf $FOLDER/ui/src/static
mkdir $FOLDER/ui/src/static
cp $GITHUB_WORKSPACE/artifact/*.wasm $FOLDER/ui/src/static
cp $GITHUB_WORKSPACE/artifact/*.js $FOLDER/ui/src/static
cp $GITHUB_WORKSPACE/artifact/playground.js.LICENSE.txt $FOLDER/ui/playground.js.LICENSE.txt
# Commit the changes and push the feature branch to origin
git add .
git commit -m "update playground"
git push origin $BRANCH_NAME
# Store the PAT in a file that can be accessed by the
# GitHub CLI.
echo "${{ secrets.ACCESS_TOKEN }}" > token.txt
# Authorize GitHub CLI for the current repository and
# create a pull-requests containing the updates.
gh auth login --with-token < token.txt
gh pr create \
--body "Port From ${{ github.head_ref }}. Commit: ${{ github.sha }}" \
--title "Update Playground" \
--head "$BRANCH_NAME" \
--base "main"