releases #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 install | |
- name: Check | |
run: npm run ci | |
release: | |
needs: build | |
if: startsWith(github.ref, 'refs/tags/') | |
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 install | |
- name: Build | |
run: | | |
npx parcel build --public-url /dist/ | |
cp dist/spreadsheet_component.html spreadsheet.dist.handlebars | |
npx parcel build --public-url https://lovasoa.github.io/sqlpage-spreadsheet/dist/ | |
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: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
release.zip | |
spreadsheet.handlebars | |
README.md | |
body: | | |
To install the Spreadsheet component: | |
Copy the spreadsheet.handlebars file to your project's 'sqlpage/templates' directory. | |
You can then use the component in your SQLPage project with `select 'spreadsheet' as component`. | |
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 checkout --orphan gh-pages | |
git rm -rf . | |
git add dist | |
git commit -m "Deploy to GitHub Pages" | |
git push -f origin gh-pages:gh-pages |