From 14cbe7caae48a2e276c0283183135cdcefd320d5 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Thu, 26 Sep 2019 04:49:31 -0400 Subject: [PATCH] rework building templates --- .github/workflows/build-templates.yml | 18 +++++++++++++++ .travis.yml | 11 --------- _template/build.sh | 18 +++++++-------- _template/create-branches.sh | 32 +++++++++++---------------- appveyor.yml | 18 --------------- 5 files changed, 40 insertions(+), 57 deletions(-) create mode 100644 .github/workflows/build-templates.yml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml diff --git a/.github/workflows/build-templates.yml b/.github/workflows/build-templates.yml new file mode 100644 index 0000000..c6e9181 --- /dev/null +++ b/.github/workflows/build-templates.yml @@ -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 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 53c7097..0000000 --- a/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -sudo: false -language: node_js -node_js: - - "stable" -env: - global: - - BUILD_TIMEOUT=10000 -branches: - only: - - master -script: _template/build.sh diff --git a/_template/build.sh b/_template/build.sh index deb8dfb..7d11a13 100755 --- a/_template/build.sh +++ b/_template/build.sh @@ -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 diff --git a/_template/create-branches.sh b/_template/create-branches.sh index 1128578..906b65a 100755 --- a/_template/create-branches.sh +++ b/_template/create-branches.sh @@ -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 \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index e75da3b..0000000 --- a/appveyor.yml +++ /dev/null @@ -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