Skip to content

Update README.md

Update README.md #52

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- run: npm test
release:
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Get version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Build
run: |
npx parcel build --public-url /dist/
./add_csp_nonce.sh
cp dist/spreadsheet_component.html spreadsheet.dist.handlebars
npx parcel build --public-url https://sqlpage.github.io/sqlpage-spreadsheet/${{ steps.get_version.outputs.VERSION }}/dist/
./add_csp_nonce.sh
cp dist/spreadsheet_component.html spreadsheet.handlebars
- name: Create Release ZIP
run: |
mkdir -p release/dist
cp -r dist/* release/dist/
mkdir -p release/sqlpage/templates
cp spreadsheet.dist.handlebars release/sqlpage/templates/spreadsheet.handlebars
cd release
zip -r ../release.zip .
- name: Get tag description
id: tag_description
run: |
git fetch --tags --force
echo "TAG_DESC<<EOF" >> $GITHUB_OUTPUT
git tag -l --format='%(contents)' ${{ github.ref_name }} >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
release.zip
spreadsheet.handlebars
README.md
body: |
## Release ${{ github.ref_name }}
${{ steps.tag_description.outputs.TAG_DESC }}
### To install the Spreadsheet component
1. Download the asset named `spreadsheet.handlebars` below.
2. Copy the file to your project's `sqlpage/templates` directory.
3. You can then use the component in your SQLPage project with
```sql
select 'spreadsheet' as component
```
### Offline distribution
The default distribution downloads the spreadsheet assets at runtime from the internet.
If you want to install the component entirely offline, you can use the `release.zip` distribution:
1. Unzip the release.zip file
2. Copy the contents of the 'dist' folder to a 'dist' directory at the root of your project
3. Copy 'sqlpage/templates/spreadsheet.handlebars' to your project's 'sqlpage/templates' directory
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy to GitHub Pages
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git fetch origin gh-pages
git checkout gh-pages
mkdir -p ${{ steps.get_version.outputs.VERSION }}
cp -r dist ${{ steps.get_version.outputs.VERSION }}/
git add ${{ steps.get_version.outputs.VERSION }}
git commit -m "Deploy version ${{ steps.get_version.outputs.VERSION }} to GitHub Pages" || echo "No changes to commit"
git push origin gh-pages