Update main.yml #996
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 <[email protected]> | |
# | |
name: openwrt-23.05 | |
on: | |
push: | |
branches: [ openwrt-23.05 ] | |
tags: | |
- v23.05.* | |
pull_request: | |
branches: [ openwrt-23.05 ] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
target: [ x86-64, nanopi-r2s ] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Set timezone | |
uses: szenius/[email protected] | |
with: | |
timezoneLinux: "Asia/Shanghai" | |
timezoneMacos: "Asia/Shanghai" | |
timezoneWindows: "China Standard Time" | |
- name: Checkout Project | |
uses: actions/checkout@v4 | |
with: | |
ref: openwrt-23.05 | |
- name: Initialize environment | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo du -xh -d4 --exclude=/{proc,sys,dev} / | grep -E '^[0-9.]*?[GTPEZY]' | |
sudo rm -rf /usr/local/lib/android | |
sudo apt-get update | |
sudo apt-get install build-essential clang flex bison g++ gawk gcc-multilib g++-multilib gettext git libelf-dev libncurses-dev libssl-dev python3-distutils rsync unzip zlib1g-dev file wget | |
sudo apt-get autoremove --purge | |
sudo apt-get clean | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
df -h | |
- name: Build OpenWrt | |
run: | | |
./build.sh -t ${{ matrix.target }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: openwrt-${{ matrix.target }} | |
path: artifact | |
publish: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/download-artifact@v4 | |
- 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 |