Skip to content

04-09-2023

04-09-2023 #29

Workflow file for this run

name: CI
# Controls when the action will run.
on:
push:
pull_request:
workflow_dispatch:
release:
types: [published]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
name: build πŸ—οΈ
runs-on: ubuntu-20.04
if: ${{ !(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) }}
env:
build_variant: ${{ matrix.build_variant }}
targets: ${{ matrix.targets }}
images_dir: /opt/images
strategy:
matrix:
include:
# - build_variant: "mt7621"
# targets: "WR1200JS K2P DIR-878 CR660x JCG-Q20 MI-4"
- build_variant: "mt7621-usb-1"
targets: "ZTE-E8820S"
# targets: "XY-C1 JCG-836PRO JCG-Y2 NEWIFI ZTE-E8820S B70"
#- build_variant: "mt7621-usb-2"
# targets: "MI-R3G JCG-AC860M NETGEAR-BZV MI-R3P R2100 RM2100 MSG1500 BELL-A040WQ"
steps:
- uses: actions/checkout@v2
- name: Prepare environment πŸͺš
run: |
sudo apt update
sudo apt install libtool-bin gperf python3-docutils autopoint gettext
- name: Run shellcheck πŸ› οΈ
run: sh ./trunk/tools/shellcheck.sh
- name: Prepare toolchain πŸ”—
run: |
cd toolchain-mipsel
sh dl_toolchain.sh
- name: Start build πŸ—οΈ
run: |
cd trunk
mkdir -p ${images_dir}
for m in $targets; do fakeroot ./build_firmware_ci $m; \
if [ $? = 0 ]; then cp -f images/*.trx ${images_dir}/$m.trx; else exit 1; fi; \
./clear_tree_simple >/dev/null 2>&1; done
- name: Create archive πŸ’Ύ
if: ${{ github.event_name != 'release' && success() }}
run: |
ls -lh ${images_dir}
GIT_VERSION=`git rev-parse --short=7 HEAD 2>/dev/null` && [ -n "$GIT_VERSION" ] && \
image_name=images_${build_variant}_${GIT_VERSION} || image_name=images_${build_variant}
cd ${images_dir}; md5sum *.trx |tee md5sum.txt; 7z a -mx=9 ${image_name}.7z ./*
echo "image_name=${image_name}" >> $GITHUB_ENV
- name: Upload images to Artifact πŸ“€
if: ${{ github.event_name != 'release' && success() }}
uses: actions/upload-artifact@v2.2.1
with:
name: ${{ env.image_name }}
path: ${{ env.images_dir }}/*.7z
- name: Upload firmware to Transfer.sh 🌐
run: |
curl -fsSL git.io/file-transfer | sh
./transfer trs --no-progress /opt/images/*.trx 2>&1 | tee log.log
echo "::warning file=transfer.sh::$(cat log.log | grep https)"
echo "download_link=$(cat log.log | grep https)" >> $GITHUB_ENV
- name: Send Download link to Telegram βœ‰οΈ
if: ${{ github.event_name != 'release' && success() }}
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
Commit message: ${{ github.event.commits[0].message }}
Repository: https://github.com/${{ github.repository }}
Releases: https://github.com/${{ github.repository }}/releases
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}
${{ env.download_link }}
- name: Upload images to Releases πŸ“€
if: ${{ github.event_name == 'release' && success() }}
uses: svenstaro/upload-release-action@2.2.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.images_dir }}/*.trx
tag: ${{ github.ref }}
overwrite: true
file_glob: true