Skip to content

Instantly share code, notes, and snippets.

@stfsy
Last active January 30, 2021 20:19
Show Gist options
  • Save stfsy/e839d5cc5c2644f3ca4509e67892dd1c to your computer and use it in GitHub Desktop.
Save stfsy/e839d5cc5c2644f3ca4509e67892dd1c to your computer and use it in GitHub Desktop.
How to move your JavaScript Build from Travis CI to Github Actions in 3 Steps
node-html-light
node-modules-scan
broccoli-plugin-adapter
broccoli-test-runner
broccoli-livereload
broccoli-image-min
broccoli-inject-livereload
broccoli-version
express-cloudfoundry-actuator-middleware
generator-stfsy-node
node-amy
node-cloudfoundry-actuator
node-cloudfoundry-actuator-cli
name: tests
on: push
jobs:
build:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [11.x, 12.x, 13.x, 14.x]
steps:
- name: Git checkout
uses: actions/checkout@master
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
env:
NODE_ENV: ci
#!/bin/bash
set -ex
declare -r ORIGIN_DOMAIN_AND_PROTOCOL="https://github.com"
declare -r ORIGIN_USER="stfsy"
declare -r REPOSITORIES_FILE="_repositories.txt"
declare -r repositories="$(cat $REPOSITORIES_FILE)"
function remove_travis_ci_conf_file {
repository=$1
travis_ci_file="${repository}"/.travis.yml
if test -f "${travis_ci_file}"; then
rm $travis_ci_file
fi
}
function add_gh_workflow_conf_file {
repository=$1
gh_workflow_file="${repository}"/.github/workflows/tests.yml
if test -f "$gh_workflow_file"; then
echo "${gh_workflow_file} already exists. Skipping directory"
continue
fi
mkdir -p "${repository}"/.github/workflows
cp ./tests.yml "${gh_workflow_file}"
}
function commit_push_and_remove_directory {
repository=$1
cd $repository
git add .
git commit -m "chore: use github actions instead of travis-ci"
git push origin master
cd ..
rm -rf $repository
}
for repository in $repositories; do
git clone "${ORIGIN_DOMAIN_AND_PROTOCOL}/${ORIGIN_USER}/${repository}"
remove_travis_ci_conf_file $repository
add_gh_workflow_conf_file $repository
commit_push_and_remove_directory $repository
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment