diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3e5ece8..1448002 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,27 +3,44 @@ name: Build network profiles on: push: branches: [master] + workflow_dispatch: jobs: + # Build all packages for x86_64 + # use latest branch of openwrt with opkg to produce feed at https://feed.libremesh.org/profiles + # use main branch of openwrt with apk to produce feed at https://feed.libremesh.org/apk/profiles + # NOTE: this doesn't sign packages for apk build: + name: Build profiles ${{ matrix.version }} runs-on: ubuntu-latest + strategy: + fail-fast: false + max-parallel: 1 + matrix: + include: + - { version: main, output_path: 'apk/'} + - { version: openwrt-23.05, output_path: ''} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Build packages - uses: openwrt/gh-action-sdk@v5 + - name: Build packages ${{ matrix.version }} + uses: openwrt/gh-action-sdk@v7 env: - ARCH: "x86_64" - EXTRA_FEEDS: "src-git|libremesh|https://github.com/libremesh/lime-packages.git" + ARCH: "x86_64-${{ matrix.version }}" +# needed? EXTRA_FEEDS: "src-git|libremesh|https://github.com/libremesh/lime-packages.git" FEEDNAME: "profiles" IGNORE_ERRORS: "n m y" - KEY_BUILD: "${{ secrets.KEY_BUILD }}" + KEY_BUILD: "${{ matrix.version != 'main' && secrets.KEY_BUILD || '' }}" + INDEX: 1 + NO_DEFAULT_FEEDS: 1 + NO_REFRESH_CHECK: 1 + NO_SHFMT_CHECK: 1 - name: Upload packages to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} - external_repository: libremesh/lime-feed + external_repository: a-gave/lime-feed publish_dir: bin/packages/x86_64/profiles/ - destination_dir: profiles + destination_dir: ${{ matrix.output_path }}profiles diff --git a/profile.mk b/profile.mk index 2a15b8e..01832cd 100644 --- a/profile.mk +++ b/profile.mk @@ -6,24 +6,19 @@ PROFILE_COMMUNITY=$(lastword $(filter-out $(PROFILE_NAME),$(subst /, ,$(CURDIR)) PKG_NAME:=profile-$(PROFILE_COMMUNITY)-$(PROFILE_NAME) PKG_MAINTAINER?=$(PROFILE_MAINTAINER) -# from https://github.com/openwrt/luci/blob/master/luci.mk +# from https://github.com/openwrt/luci/blob/master/luci.mk +# default package version follow this scheme: +# [year].[day_of_year].[seconds_of_day]~[commit_short_hash] eg. 24.322.80622~a403707 PKG_VERSION?=$(if $(DUMP),x,$(strip $(shell \ - if svn info >/dev/null 2>/dev/null; then \ - revision="svn-r$$(LC_ALL=C svn info | sed -ne 's/^Revision: //p')"; \ - elif git log -1 >/dev/null 2>/dev/null; then \ - revision="svn-r$$(LC_ALL=C git log -1 | sed -ne 's/.*git-svn-id: .*@\([0-9]\+\) .*/\1/p')"; \ - if [ "$$revision" = "svn-r" ]; then \ - set -- $$(git log -1 --format="%ct %h" --abbrev=7); \ - secs="$$(($$1 % 86400))"; \ - yday="$$(date --utc --date="@$$1" "+%y.%j")"; \ - revision="$$(printf 'git-%s.%05d-%s' "$$yday" "$$secs" "$$2")"; \ - fi; \ - else \ - revision="unknown"; \ - fi; \ - echo "$$revision" \ + if git log -1 >/dev/null 2>/dev/null; then \ + set -- $$(git log -1 --format="%ct %h" --abbrev=7); \ + secs="$$(($$1 % 86400))"; \ + yday="$$(date --utc --date="@$$1" "+%y.%j")"; \ + printf '%s.%05d~%s' "$$yday" "$$secs" "$$2"; \ + else \ + echo "0"; \ + fi; \ ))) -PKG_RELEASE?=1 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) @@ -35,7 +30,7 @@ define Package/$(PKG_NAME) CATEGORY:=LibreMesh TITLE:=$(if $(PROFILE_TITLE),$(PROFILE_TITLE),Profile $(PROFILE_COMMUNITY) $(PROFILE_NAME)) DEPENDS:=+lime-system $(PROFILE_DEPENDS) - VERSION:=$(if $(PKG_VERSION),$(PKG_VERSION),$(PKG_SRC_VERSION)) + VERSION:=$(PKG_VERSION) PKGARCH:=all URL:=https://github.com/libremesh/network-profiles/ endef