fix: make init script executable and bump version to 0.1.1 #3
This file contains hidden or 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
| name: "Build Packages" | |
| on: | |
| repository_dispatch: | |
| workflow_dispatch: {} | |
| push: | |
| branches: | |
| - "main" | |
| paths: | |
| - "Makefile" | |
| permissions: | |
| contents: write | |
| env: | |
| TZ: Europe/Madrid | |
| jobs: | |
| job_check: | |
| name: Check Version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.check_version.outputs.latest_version }} | |
| has_update: ${{ steps.check_version.outputs.has_update }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: "main" | |
| - name: Check version | |
| id: check_version | |
| env: | |
| url_release: https://api.github.com/repos/${{ github.repository }}/releases/latest | |
| run: | | |
| latest_version=$(grep -oP 'PKG_VERSION:=\K.*' Makefile | sed 's/^/v/') | |
| latest_release=$(wget -qO- -t1 -T2 ${{ env.url_release }} | awk -F '"' '/tag_name/{print $4}') | |
| has_update=$([ "${latest_version}" != "${latest_release}" ] && echo true || echo false) | |
| echo "latest_version=${latest_version}" >> "$GITHUB_OUTPUT" | |
| echo "has_update=${has_update}" >> "$GITHUB_OUTPUT" | |
| echo "latest_version: ${latest_version}" | |
| echo "latest_release: ${latest_release}" | |
| echo "has_update: ${has_update}" | |
| - name: Generate new tag & release | |
| if: steps.check_version.outputs.has_update == 'true' | |
| uses: softprops/action-gh-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| name: luci-app-tailscale-ng | |
| tag_name: ${{ steps.check_version.outputs.latest_version }} | |
| job_build: | |
| name: Build ${{ matrix.package_ext }} package | |
| needs: job_check | |
| if: needs.job_check.outputs.has_update == 'true' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - package_ext: ipk | |
| sdk_cache_key: openwrt-sdk-24.10-x86-64 | |
| sdk_url: https://archive.openwrt.org/releases/24.10.4/targets/x86/64/openwrt-sdk-24.10.4-x86-64_gcc-13.3.0_musl.Linux-x86_64.tar.zst | |
| feeds_base_branch: openwrt-24.10 | |
| feeds_packages_branch: openwrt-24.10 | |
| feeds_luci_branch: openwrt-24.10 | |
| feeds_routing_branch: openwrt-24.10 | |
| extra_config: CONFIG_LUCI_LANG_zh_Hans=n | |
| - package_ext: apk | |
| sdk_cache_key: openwrt-sdk-snapshot-x86-64 | |
| sdk_url: https://downloads.openwrt.org/snapshots/targets/x86/64/openwrt-sdk-x86-64_gcc-14.3.0_musl.Linux-x86_64.tar.zst | |
| feeds_base_branch: main | |
| feeds_packages_branch: master | |
| feeds_luci_branch: master | |
| feeds_routing_branch: master | |
| extra_config: CONFIG_USE_APK=y | |
| steps: | |
| - name: Install packages | |
| run: | | |
| sudo -E apt-get -qq update | |
| sudo -E apt-get -qq install build-essential clang flex bison g++ gawk gcc-multilib g++-multilib gettext git libncurses5-dev libssl-dev rsync unzip zlib1g-dev file wget | |
| sudo -E apt-get -qq autoremove --purge | |
| sudo -E apt-get -qq clean | |
| - name: Cache OpenWrt SDK | |
| id: cache-sdk | |
| uses: actions/cache@v3 | |
| with: | |
| path: sdk | |
| key: ${{ matrix.sdk_cache_key }} | |
| - name: Initialize SDK | |
| if: steps.cache-sdk.outputs.cache-hit != 'true' | |
| run: | | |
| wget "${{ matrix.sdk_url }}" | |
| file_name=$(echo "${{ matrix.sdk_url }}" | awk -F/ '{print $NF}') | |
| mkdir sdk | |
| tar -xf "${file_name}" -C ./sdk --strip-components=1 | |
| cd sdk | |
| { | |
| echo "src-git base https://github.com/openwrt/openwrt.git;${{ matrix.feeds_base_branch }}" | |
| echo "src-git-full packages https://github.com/openwrt/packages.git;${{ matrix.feeds_packages_branch }}" | |
| echo "src-git-full luci https://git.openwrt.org/project/luci.git;${{ matrix.feeds_luci_branch }}" | |
| echo "src-git-full routing https://git.openwrt.org/feed/routing.git;${{ matrix.feeds_routing_branch }}" | |
| } > feeds.conf | |
| git clone -b main "https://github.com/${{ github.repository }}.git" package/downloads/luci-app-tailscale-ng | |
| ./scripts/feeds update -a | |
| echo "CONFIG_PACKAGE_luci-app-tailscale-ng=m" > .config | |
| ./scripts/feeds install -d n luci-app-tailscale-ng | |
| make download -j"$(nproc)" | |
| - name: Configure build | |
| run: | | |
| cd sdk | |
| ./scripts/feeds install luci-app-tailscale-ng | |
| { | |
| echo "CONFIG_ALL_NONSHARED=n" | |
| echo "CONFIG_ALL_KMODS=n" | |
| echo "CONFIG_ALL=n" | |
| echo "CONFIG_AUTOREMOVE=n" | |
| echo "${{ matrix.extra_config }}" | |
| echo "CONFIG_PACKAGE_luci-app-tailscale-ng=m" | |
| } > .config | |
| make defconfig | |
| - name: Compile package | |
| id: compile | |
| run: | | |
| cd sdk | |
| make package/luci-app-tailscale-ng/{clean,compile} -j"$(nproc)" | |
| mkdir -p ../release-artifacts | |
| find bin/packages -type f -name "luci-app-tailscale-ng*.${{ matrix.package_ext }}" -exec cp {} ../release-artifacts/ \; | |
| if ! ls ../release-artifacts/*.${{ matrix.package_ext }} >/dev/null 2>&1; then | |
| echo "No .${{ matrix.package_ext }} package was produced" | |
| exit 1 | |
| fi | |
| cd .. | |
| echo "status=success" >> "$GITHUB_OUTPUT" | |
| echo "FIRMWARE=$PWD" >> "$GITHUB_ENV" | |
| - name: Upload package to release | |
| if: steps.compile.outputs.status == 'success' | |
| uses: softprops/action-gh-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ needs.job_check.outputs.version }} | |
| files: ${{ env.FIRMWARE }}/release-artifacts/*.${{ matrix.package_ext }} |