2018-07-09 08:03:44 -06:00
|
|
|
version: 2
|
|
|
|
jobs:
|
2018-07-11 21:50:28 -06:00
|
|
|
######################################
|
|
|
|
# Common
|
|
|
|
######################################
|
2018-07-09 08:03:44 -06:00
|
|
|
build:
|
|
|
|
docker:
|
|
|
|
- image: arednmesh/builder
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
name: Update Config.mk
|
|
|
|
command: |
|
2018-07-09 12:08:22 -06:00
|
|
|
export MY_WORKING_DIRECTORY=`pwd`
|
|
|
|
ls -la
|
2018-07-11 21:50:28 -06:00
|
|
|
sed -i "s/NoCall/${CIRCLE_BUILD_NUM}/g" ${MY_WORKING_DIRECTORY}/config.mk
|
2018-07-09 12:08:22 -06:00
|
|
|
cat ${MY_WORKING_DIRECTORY}/config.mk
|
2018-07-09 08:03:44 -06:00
|
|
|
set
|
|
|
|
- run:
|
|
|
|
name: Build
|
|
|
|
command: make
|
2018-07-11 21:50:28 -06:00
|
|
|
- run:
|
|
|
|
name: Build
|
|
|
|
command: make SUBTARGET=mikrotik
|
2018-07-09 08:03:44 -06:00
|
|
|
- run:
|
|
|
|
name: Compress build files
|
2018-07-12 08:39:08 -06:00
|
|
|
command: tar -cjf ~/${CIRCLE_BRANCH}_${ARTIFACTS_FILE} -C ${MY_WORKING_DIRECTORY}/${ARTIFACTS_DIR} .
|
2018-07-09 08:03:44 -06:00
|
|
|
- run:
|
|
|
|
name: Deploy Files
|
2018-07-12 09:48:58 -06:00
|
|
|
command: scp -o StrictHostKeyChecking=no ~/${CIRCLE_BRANCH}_${ARTIFACTS_FILE} ${SSH_USER}@${SSH_HOST}:~/
|
2018-07-11 21:50:28 -06:00
|
|
|
|
|
|
|
######################################
|
|
|
|
# Nightly
|
|
|
|
######################################
|
|
|
|
process_artifacts_nightly:
|
|
|
|
machine:
|
|
|
|
enabled: true
|
|
|
|
steps:
|
2018-07-09 08:03:44 -06:00
|
|
|
- run:
|
2018-07-09 13:50:17 -06:00
|
|
|
name: Untar Files
|
2018-07-11 21:50:28 -06:00
|
|
|
command: ssh ${SSH_USER}@${SSH_HOST} "sh -c 'tar -xjf ~/${CIRCLE_BRANCH}_${ARTIFACTS_FILE} -C ~/'"
|
2018-07-14 22:47:51 -06:00
|
|
|
#- run:
|
|
|
|
# name: Remove tarball
|
|
|
|
# command: ssh ${SSH_USER}@${SSH_HOST} "sh -c 'rm ~/${CIRCLE_BRANCH}_${ARTIFACTS_FILE}'"
|
2018-07-09 13:50:17 -06:00
|
|
|
- run:
|
|
|
|
name: Empty nightly dir
|
|
|
|
command: ssh ${SSH_USER}@${SSH_HOST} "sh -c 'rm -rf ${NIGHTLY_DIR}'"
|
2018-07-14 22:47:51 -06:00
|
|
|
- run:
|
|
|
|
name: Create nightly dir
|
|
|
|
command: ssh ${SSH_USER}@${SSH_HOST} "sh -c 'mkdir -p ${NIGHTLY_DIR}'"
|
2018-07-09 13:50:17 -06:00
|
|
|
- run:
|
|
|
|
name: Move targets
|
2018-07-09 08:03:44 -06:00
|
|
|
command: ssh ${SSH_USER}@${SSH_HOST} "sh -c 'mv ~/targets ${NIGHTLY_DIR}'"
|
2018-07-09 13:50:17 -06:00
|
|
|
- run:
|
|
|
|
name: Move packages
|
2018-07-11 21:50:28 -06:00
|
|
|
command: ssh ${SSH_USER}@${SSH_HOST} "sh -c 'mv ~/packages ${NIGHTLY_DIR}'"
|
|
|
|
|
|
|
|
changelog_nightly:
|
|
|
|
machine:
|
|
|
|
enabled: true
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: Generate changelog.md
|
|
|
|
command: ssh ${SSH_USER}@${SSH_HOST} "sh -c 'docker run --rm -v ~/:/usr/local/src/your-app ferrarimarco/github-changelog-generator -u ${CIRCLE_PROJECT_USERNAME} -p ${CIRCLE_PROJECT_REPONAME} -t ${GITHUB_TOKEN}'"
|
|
|
|
- run:
|
|
|
|
name: Move changelog
|
|
|
|
command: ssh ${SSH_USER}@${SSH_HOST} "sh -c 'mv ~/CHANGELOG.md ${NIGHTLY_DIR}'"
|
|
|
|
|
|
|
|
readme_nightly:
|
|
|
|
machine:
|
|
|
|
enabled: true
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: Fetch README.md
|
|
|
|
command: ssh ${SSH_USER}@${SSH_HOST} "sh -c 'wget https://raw.githubusercontent.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/${CIRCLE_BRANCH}/README.md'"
|
|
|
|
- run:
|
|
|
|
name: Move README.md
|
2018-07-12 08:58:45 -06:00
|
|
|
command: ssh ${SSH_USER}@${SSH_HOST} "sh -c 'mv ~/README.md ${NIGHTLY_DIR}/readme.md'"
|
2018-07-11 21:50:28 -06:00
|
|
|
|
|
|
|
######################################
|
|
|
|
# Workflows
|
|
|
|
######################################
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
|
|
|
|
nightly:
|
|
|
|
triggers:
|
|
|
|
- schedule:
|
|
|
|
cron: "0 9 * * *" # 9AM UTC
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: develop
|
|
|
|
jobs:
|
|
|
|
- build
|
|
|
|
- process_artifacts_nightly:
|
|
|
|
requires:
|
|
|
|
- build
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: develop
|
|
|
|
- readme_nightly:
|
|
|
|
requires:
|
2018-07-13 09:22:59 -06:00
|
|
|
- process_artifacts_nightly
|
2018-07-11 21:50:28 -06:00
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- develop
|
|
|
|
- changelog_nightly:
|
|
|
|
requires:
|
2018-07-13 09:22:59 -06:00
|
|
|
- process_artifacts_nightly
|
2018-07-11 21:50:28 -06:00
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: develop
|