Update build.sh #955
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This is free software, license use GPLv3. | |
# | |
# Copyright (c) 2020, Chuck <fanck0605@qq.com> | |
# | |
name: openwrt-22.03 | |
on: | |
push: | |
branches: [ openwrt-22.03 ] | |
tags: | |
- v22.03.* | |
pull_request: | |
branches: [ openwrt-22.03 ] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
target: [ x86-64, nanopi-r2s ] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Set timezone | |
uses: szenius/set-timezone@v1.1 | |
with: | |
timezoneLinux: "Asia/Shanghai" | |
timezoneMacos: "Asia/Shanghai" | |
timezoneWindows: "China Standard Time" | |
- name: Checkout Project | |
uses: actions/checkout@v3 | |
with: | |
ref: openwrt-22.03 | |
- name: Show large directories | |
run: | | |
df -h | |
sudo du -xh --exclude=/{proc,sys,dev} / | grep -E '^[0-9.]*?[GTPEZY]' | |
- name: Initialize Environment | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo rm -rf /usr/local/lib/android | |
sudo apt-get update | |
sudo apt-get install build-essential ccache ecj fastjar file g++ gawk gettext git java-propose-classpath libelf-dev libncurses5-dev libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget python3-distutils python3-setuptools python3-dev quilt rsync subversion swig time xsltproc zlib1g-dev | |
sudo apt-get autoremove --purge | |
sudo apt-get clean | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
- name: Show disk space usage | |
run: | | |
df -h | |
- name: Build OpenWrt | |
run: | | |
./build.sh -t ${{ matrix.target }} | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: openwrt-${{ matrix.target }} | |
path: artifact | |
publish: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/download-artifact@v3 | |
- name: Create release tarball | |
run: | | |
release_version=${GITHUB_REF_NAME#v} | |
echo "RELEASE_VERSION=$release_version" >>"$GITHUB_ENV" | |
for artifact in openwrt-*; do | |
pushd "$artifact" | |
tar -zcf ../openwrt-"$release_version"-"${artifact#openwrt-}".tar.gz * | |
popd | |
done | |
- uses: softprops/action-gh-release@v1 | |
with: | |
files: openwrt-${{ env.RELEASE_VERSION }}-*.tar.gz |