diff --git a/.github/workflows/openwrt-ci.yml b/.github/workflows/openwrt-ci.yml index d662f5a1b1fc09..a990bc6155a655 100644 --- a/.github/workflows/openwrt-ci.yml +++ b/.github/workflows/openwrt-ci.yml @@ -1,29 +1,30 @@ -# -# This is free software, lisence use MIT. -# -# Copyright (C) 2019 P3TERX -# Copyright (C) 2019 KFERMercer # # -# - +# +# Copyright (C) 2019 P3TERX +# +# Copyright (C) 2020 KFERMercer +# name: OpenWrt-CI on: schedule: - cron: 0 20 * * * - push: - tags: - - '*' + release: + types: [published] jobs: build_openwrt: - name: Build OpenWrt and release - runs-on: ubuntu-18.04 + name: Build OpenWrt firmware + + runs-on: ubuntu-latest + + if: github.event.repository.owner.id == github.event.sender.id steps: + - name: Checkout uses: actions/checkout@v2 with: @@ -35,7 +36,7 @@ jobs: run: | docker rmi `docker images -q` sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d - sudo -E apt-get -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php* + sudo -E apt-get -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php* android* sudo -E apt-get update sudo -E apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs gcc-multilib g++-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler antlr3 gperf swig sudo -E apt-get -y autoremove --purge @@ -45,7 +46,7 @@ jobs: - name: Update feeds run: | - sed -i 's/\"#src-git\"/\"src-git\"/g' ./feeds.conf.default + sed -i 's/#src-git helloworld/src-git helloworld/g' ./feeds.conf.default ./scripts/feeds update -a ./scripts/feeds install -a @@ -70,32 +71,39 @@ jobs: du -h --max-depth=1 ./bin - name: Prepare artifact - run: find ./bin/targets/ -type d -name "packages" | xargs rm -rf {} + run: | + mkdir -p ./artifact/firmware + mkdir -p ./artifact/package + mkdir -p ./artifact/buildinfo + rm -rf $(find ./bin/targets/ -type d -name "packages") + cp -rf $(find ./bin/targets/ -type f) ./artifact/firmware/ + cp -rf $(find ./bin/packages/ -type f -name "*.ipk") ./artifact/package/ + cp -rf $(find ./bin/targets/ -type f -name "*.buildinfo" -o -name "*.manifest") ./artifact/buildinfo/ + + - name: Deliver buildinfo + uses: actions/upload-artifact@v2 + with: + name: OpenWrt_buildinfo + path: ./artifact/buildinfo/ - - name: Upload artifact - uses: actions/upload-artifact@master + - name: Deliver package + uses: actions/upload-artifact@v2 with: - name: OpenWrt_firmware - path: ./bin/targets/ + name: OpenWrt_package + path: ./artifact/package/ - - name: Create release - if: github.event == 'push' - id: create_release - uses: actions/create-release@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Deliver firmware + uses: actions/upload-artifact@v2 with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - draft: false - prerelease: false + name: OpenWrt_firmware + path: ./bin/targets/ + - name: Upload release asset - if: github.event == 'push' - id: upload-release-asset - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + if: github.event == 'release' + uses: svenstaro/upload-release-action@v2 with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./bin/targets/*/*/ + repo_token: ${{ secrets.YOURTOKEN }} + file: ./artifact/firmware/* + tag: ${{ github.ref }} + file_glob: true