Skip to content
Permalink
Browse files

fix: website generation and deployment

add distribution and source downloads to the website
migrate to Github Actions
  • Loading branch information
kevinchappell committed Feb 2, 2020
1 parent 1314b85 commit 6ba8ce094c2b28853413613f46581f7cc79702e3
Showing with 104 additions and 86 deletions.
  1. +37 −0 .github/workflows/deploy.yaml
  2. +32 −0 .github/workflows/publish.yaml
  3. +0 −54 .travis.yml
  4. +1 −1 mkdocs.yml
  5. +2 −2 package.json
  6. +1 −1 tools/build-vendor.js
  7. +15 −0 tools/deploy-demo.js
  8. +16 −0 tools/deploy-site.js
  9. +0 −28 tools/deploy.js
@@ -0,0 +1,37 @@
name: Deploy Demo

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node: [12]
steps:
- uses: actions/checkout@v2
- name: Set up Nodejs ${{ matrix.node }}
uses: actions/setup-node@v1
- name: Install dependencies
env:
CI: true
run: npm install
- name: Build the plugin
run: npm run build
- name: Deploy the plugin
if: success()
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
FORMBUILDER_WEBSITE_DIR: ${{ secrets.FORMBUILDER_WEBSITE_DIR }}
FORMBUILDER_WEBSITE_REPO: ${{ secrets.FORMBUILDER_WEBSITE_REPO }}
run: |
echo "https://${{ secrets.GH_TOKEN }}:@github.com" > .git/credentials
git config --global credential.helper "store --file=.git/credentials"
git config --local user.email "kevin.b.chappell@gmail.com"
git config --local user.name "Kevin Chappell"
git clone --depth 1 ${{ secrets.FORMBUILDER_WEBSITE_REPO }} ${{ secrets.FORMBUILDER_WEBSITE_DIR }} 2> /dev/null
npm run deploy:all
@@ -0,0 +1,32 @@
name: Publish

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node: [12]
steps:
- uses: actions/checkout@v2
- name: Set up Nodejs ${{ matrix.node }}
uses: actions/setup-node@v1
- name: Install dependencies
env:
CI: true
run: npm install
- name: Build the plugin
run: npm run build
- name: Publish the plugin
if: success()
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
FORMBUILDER_WEBSITE_DIR: ${{ secrets.FORMBUILDER_WEBSITE_DIR }}
FORMBUILDER_WEBSITE_REPO: ${{ secrets.FORMBUILDER_WEBSITE_REPO }}
run: npx semantic-release

This file was deleted.

@@ -1,6 +1,6 @@
site_name: formBuilder
site_url: https://formbuilder.online
site_dir: site/src/docs
site_dir: site/public/docs
repo_url: https://github.com/kevinchappell/formBuilder
repo_name: 'GitHub'
site_description: A jQuery plugin for drag and drop form creation
@@ -83,8 +83,8 @@
"build:all": "npm-run-all build:plugins build:vendor build copy",
"copy": "cp -a dist/* demo/assets/js/ && cp CONTRIBUTING.md docs/contributing.md && cp LICENSE docs/license.md && mkdir -p demo/assets/lang && cp node_modules/formbuilder-languages/*.lang demo/assets/lang/",
"deploy:all": "npm-run-all deploy:demo deploy:site",
"deploy:demo": "node tools/deploy.js",
"deploy:site": "npm run-script docs && cd site/ && npm run-script deploy && cd ../",
"deploy:demo": "node tools/deploy-demo.js",
"deploy:site": "node tools/deploy-site.js",
"docs": "mkdocs build",
"font": "babel-node tools/icon-font",
"lint": "eslint ./src --ext .js || true",
@@ -12,6 +12,6 @@ const vendor = Object.keys(pkg.dependencies).map(require.resolve)
* Concatenates the vendor files into a single vendor file for the demo
* @return {Function} concat
*/
concat(vendor, `${targetDir}/vendor.js`, function(err, data) {
concat(vendor, `${targetDir}/vendor.js`, err => {
if (err) throw err
})
@@ -0,0 +1,15 @@
const { exec } = require('child_process')
const pkg = require('../package.json')

const commands = [
'git add --all',
`git commit -am "${pkg.version}"`,
'git push origin $(git subtree split --prefix demo $(git rev-parse --abbrev-ref HEAD)):gh-pages --force',
]

// try to deploy the demo
try {
exec(commands.join(' && '), err => !err && console.log('Demo successfully deployed'))
} catch (e) {
console.error(e)
}
@@ -0,0 +1,16 @@
const { exec } = require('child_process')
const pkg = require('../package.json')

const commands = [
`npm version ${pkg.version}`,
'git push origin master',
]

const cwd = process.env.FORMBUILDER_WEBSITE_DIR || 'site'

// try to deploy the demo
try {
exec(commands.join(' && '), { cwd }, err => !err && console.log('Site successfully deployed'))
} catch (e) {
console.error(e)
}

This file was deleted.

0 comments on commit 6ba8ce0

Please sign in to comment.
You can’t perform that action at this time.