2020-09-11 07:33:30 +00:00
|
|
|
name: Build OpenMPTCProuter
|
2020-02-22 07:30:40 +00:00
|
|
|
on: [push]
|
|
|
|
|
2020-09-11 09:00:01 +00:00
|
|
|
env:
|
2020-09-11 13:26:37 +00:00
|
|
|
REPO_URL: 'https://github.com/ysurac/openmptcprouter'
|
|
|
|
OMR_TARGET: 'x86_64'
|
|
|
|
OMR_KERNEL: '5.4'
|
2020-09-11 09:00:01 +00:00
|
|
|
|
2020-02-22 07:30:40 +00:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
2020-02-23 08:50:53 +00:00
|
|
|
runs-on: ubuntu-latest
|
2020-02-22 07:30:40 +00:00
|
|
|
|
|
|
|
steps:
|
2020-09-11 13:26:37 +00:00
|
|
|
- name: Branch name
|
|
|
|
id: branch_name
|
|
|
|
run: |
|
|
|
|
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
|
|
|
|
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
|
|
|
|
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
|
2020-02-22 07:30:40 +00:00
|
|
|
- name: Prepare
|
2020-02-23 08:53:02 +00:00
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2020-03-04 09:10:11 +00:00
|
|
|
sudo apt-get install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler
|
2020-09-11 07:32:13 +00:00
|
|
|
- name: Clone source code
|
|
|
|
env:
|
|
|
|
REPO_URL: https://github.com/ysurac/openmptcprouter
|
2020-09-11 13:26:37 +00:00
|
|
|
SOURCE_BRANCH: ${{ steps.branch_name.outputs.SOURCE_BRANCH }}
|
|
|
|
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
|
2020-09-11 07:32:13 +00:00
|
|
|
run: |
|
2020-09-11 13:26:37 +00:00
|
|
|
git clone --depth 1 $REPO_URL openmptcprouter
|
|
|
|
cd openmptcprouter
|
|
|
|
git checkout ${SOURCE_BRANCH:-$SOURCE_TAG}
|
|
|
|
git pull
|
2020-03-04 09:11:29 +00:00
|
|
|
- name: Build toolchain
|
2020-09-11 07:50:42 +00:00
|
|
|
working-directory: ./openmptcprouter
|
2020-02-22 07:30:40 +00:00
|
|
|
env:
|
2020-09-11 07:46:43 +00:00
|
|
|
OMR_FEED_URL: https://github.com/ysurac/openmptcprouter-feeds
|
2020-09-11 13:26:37 +00:00
|
|
|
SOURCE_BRANCH: ${{ steps.branch_name.outputs.SOURCE_BRANCH }}
|
|
|
|
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
|
2020-02-22 07:30:40 +00:00
|
|
|
run: |
|
2020-09-11 13:26:37 +00:00
|
|
|
OMR_FEED_SRC="${SOURCE_BRANCH:-$SOURCE_TAG}" sh build.sh prepare {tools,toolchain}/install -j$(nproc)
|
|
|
|
#echo -e "${{ secrets.OMR_PRIVKEY }}" > $OMR_TARGET/source/key-build
|
|
|
|
#echo -e "${{ secrets.OMR_PUBKEY }}" > $OMR_TARGET/source/key-build.pub
|
2020-09-11 07:46:43 +00:00
|
|
|
- name: Build packages
|
2020-09-11 07:50:42 +00:00
|
|
|
working-directory: ./openmptcprouter
|
2020-09-11 07:46:43 +00:00
|
|
|
run: |
|
2020-09-11 09:00:01 +00:00
|
|
|
make IGNORE_ERRORS=m -C $OMR_TARGET/source package/{compile,install,index} -j$(nproc)
|
2020-09-11 07:46:43 +00:00
|
|
|
- name: Build image
|
2020-09-11 07:50:42 +00:00
|
|
|
working-directory: ./openmptcprouter
|
2020-09-11 07:46:43 +00:00
|
|
|
run: |
|
2020-09-11 09:00:01 +00:00
|
|
|
make IGNORE_ERRORS=m -C $OMR_TARGET/source target/install -j$(nproc)
|
2020-09-11 13:26:37 +00:00
|
|
|
- name: Deploy - Create directory
|
|
|
|
uses: fifsky/ssh-action@master
|
|
|
|
env:
|
|
|
|
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
|
|
|
|
SOURCE_BRANCH: ${{ steps.branch_name.outputs.SOURCE_BRANCH }}
|
|
|
|
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
|
|
|
|
with:
|
|
|
|
command: |
|
|
|
|
mkdir -p deploy/${SOURCE_BRANCH:-release}/${SOURCE_TAG:-$OMR_KERNEL}/${OMR_TARGET}
|
|
|
|
host: ${{ secrets.OMR_DEPLOY_HOST }}
|
|
|
|
user: deploy
|
|
|
|
port: ${{ secrets.OMR_DEPLOY_PORT }}
|
|
|
|
key: ${{ secrets.PRIVATE_KEY }}
|
|
|
|
- name: Deploy - Upload via rsync
|
|
|
|
uses: trendyminds/github-actions-rsync@master
|
|
|
|
with:
|
|
|
|
RSYNC_OPTIONS: -av --delete-after
|
|
|
|
RSYNC_TARGET: deploy/${SOURCE_BRANCH:-release}/${SOURCE_TAG:-$OMR_KERNEL}/${OMR_TARGET}
|
|
|
|
RSYNC_SOURCE: ./openmptcprouter/${OMR_TARGET}/source/bin/
|
|
|
|
env:
|
|
|
|
SSH_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
|
|
|
|
SSH_USERNAME: deploy
|
|
|
|
SSH_HOSTNAME: ${{ secrets.OMR_DEPLOY_HOST }}
|
|
|
|
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
|
|
|
|
SOURCE_BRANCH: ${{ steps.branch_name.outputs.SOURCE_BRANCH }}
|
|
|
|
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
|
2020-02-22 07:30:40 +00:00
|
|
|
|