rework building templates

This commit is contained in:
Conduitry
2019-09-26 04:49:31 -04:00
parent 190168b8a1
commit 14cbe7caae
5 changed files with 40 additions and 57 deletions

18
.github/workflows/build-templates.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
name: Create templates
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
-
env:
CI: true
SSH_KEY: ${{ secrets.SSH_KEY }}
SSH_KEY_ROLLUP: ${{ secrets.SSH_KEY_ROLLUP }}
SSH_KEY_WEBPACK: ${{ secrets.SSH_KEY_WEBPACK }}
run: _template/build.sh

View File

@@ -1,11 +0,0 @@
sudo: false
language: node_js
node_js:
- "stable"
env:
global:
- BUILD_TIMEOUT=10000
branches:
only:
- master
script: _template/build.sh

View File

@@ -1,19 +1,19 @@
#!/bin/bash
cd "$(dirname $0)"
cd "$(dirname "$0")"
if [ "$CI" ]; then
# write out SSH key
[ "$SSH_KEY" ] || exit 1
echo "$SSH_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
(umask 0077; echo "$SSH_KEY" > ~/ssh_key; echo "$SSH_KEY_ROLLUP" > ~/ssh_key_rollup; echo "$SSH_KEY_WEBPACK" > ~/ssh_key_webpack)
git config user.email 'noreply@svelte.dev'
git config user.name '[bot]'
fi
# branch names
DEFAULT=master
ROLLUP=rollup
WEBPACK=webpack
./create-branches.sh $DEFAULT $ROLLUP $WEBPACK
./create-branches.sh $ROLLUP $WEBPACK
# force push rollup and webpack branches
git push git@github.com:sveltejs/sapper-template.git $ROLLUP $WEBPACK -f
# force push rollup and webpack branches and repos
GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=accept-new -i ~/ssh_key' git push git@github.com:sveltejs/sapper-template.git $ROLLUP $WEBPACK -f
GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=accept-new -i ~/ssh_key_rollup' git push git@github.com:sveltejs/sapper-template-rollup.git $ROLLUP:master -f
GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=accept-new -i ~/ssh_key_webpack' git push git@github.com:sveltejs/sapper-template-webpack.git $WEBPACK:master -f

View File

@@ -1,31 +1,25 @@
#!/bin/bash
cd "$(dirname $0)"/..
cd "$(dirname "$0")"/..
DEFAULT=${1:-master}
ROLLUP=${2:-rollup}
WEBPACK=${3:-webpack}
HEAD=$(git rev-parse HEAD)
echo "Creating $ROLLUP and $WEBPACK branches from $DEFAULT"
ROLLUP=${1:-rollup}
WEBPACK=${2:-webpack}
# make sure we're on master, and delete the $ROLLUP and $WEBPACK branches
git symbolic-ref HEAD "refs/heads/$DEFAULT"
git reset --hard
git branch -D $ROLLUP $WEBPACK
echo "Creating $ROLLUP and $WEBPACK branches from $REV"
# create the $ROLLUP branch off the current master
git checkout -b $ROLLUP
# create the $ROLLUP branch off the current HEAD
git symbolic-ref HEAD refs/heads/$ROLLUP
git reset $HEAD --hard
node _template/build-pkg.js rollup
git rm -r --cached .travis.yml _template package_template.json webpack.config.js
git rm -r --cached .github _template package_template.json webpack.config.js
git add package.json
git commit -m 'Sapper template for Rollup'
git symbolic-ref HEAD "refs/heads/$DEFAULT"
git reset --hard
# create the $WEBPACK branch off the current master
git checkout -b $WEBPACK
# create the $WEBPACK branch off the current HEAD
git symbolic-ref HEAD refs/heads/$WEBPACK
git reset $HEAD --hard
node _template/build-pkg.js webpack
git rm -r --cached .travis.yml _template package_template.json rollup.config.js
git rm -r --cached .github _template package_template.json rollup.config.js
git add package.json
git commit -m 'Sapper template for webpack'
git symbolic-ref HEAD "refs/heads/$DEFAULT"
git reset --hard

View File

@@ -1,18 +0,0 @@
version: "{build}"
shallow_clone: true
init:
- git config --global core.autocrlf false
build: off
environment:
matrix:
# node.js
- nodejs_version: stable
install:
- ps: Install-Product node $env:nodejs_version
- npm install cypress
- npm install