Skip to content

build

build #12

Workflow file for this run

name: build
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.prepare.outputs.tag }}
strategy:
matrix:
branch: [openwrt-23.05]
arch:
- aarch64_cortex-a53
- mipsel_24kc
- x86_64
container:
image: openwrt/sdk:${{ matrix.arch }}-${{ matrix.branch }}
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: 'a1ef/nfqws-openwrt'
path: nfqws-openwrt
- name: Setup ccache
uses: actions/cache@v4
with:
path: '/builder/.ccache'
key: ccache-${{ matrix.arch }}-${{ matrix.branch }}-${{ github.run_id }}
restore-keys: |
ccache-${{ matrix.arch }}-${{ matrix.branch }}-
- name: Prepare build
id: prepare
shell: bash
run : |
apt update
apt install -y jq
TAG=$(wget -qO- 'https://api.github.com/repos/bol-van/zapret/releases/latest' | jq -r '.tag_name')
find -name Makefile
sed -i "s|_VERSION_|${TAG/v}|" nfqws/Makefile
echo "tag=${TAG}" >> $GITHUB_OUTPUT
- name: Build package
id: build
working-directory: /builder
env:
ARCH: ${{ matrix.arch }}
BRANCH: ${{ matrix.branch }}
CCACHE_DIR: /builder/.ccache
shell: bash
run: |
cp -r .gnupg /github/home
./setup.sh
echo "src-link nfqws $GITHUB_WORKSPACE" >> feeds.conf
cp -r $GITHUB_WORKSPACE/nfqws-openwrt package/nfqws-openwrt/
./scripts/feeds update nfqws
./scripts/feeds install -ap nfqws
make defconfig
make package/nfqws/compile V=s -j$(nproc) BUILD_LOG=1
make package/index
tar cvf "${GITHUB_WORKSPACE}/ipk-${BRANCH}-${ARCH}.tar" -C bin/packages/*/nfqws --transform "s|^\./|${BRANCH/openwrt-}/${ARCH}/|" --show-transformed-names .
- name: Compress build logs
if: always()
env:
ARCH: ${{ matrix.arch }}
BRANCH: ${{ matrix.branch }}
LOGS_DIR: '/builder/logs'
run: |
[ -d "${LOGS_DIR}" ] || mkdir "${LOGS_DIR}"
tar cJvf "logs-${BRANCH}-${ARCH}.tar.xz" "${LOGS_DIR}"
- name: Upload packages
if: steps.build.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: ipk-${{ matrix.branch }}-${{ matrix.arch }}
path: ./**/ipk-${{ matrix.branch }}-${{ matrix.arch }}.tar
if-no-files-found: error
- name: Upload build logs
if: always()
uses: actions/upload-artifact@v4
with:
name: logs-${{ matrix.branch }}-${{ matrix.arch }}
path: ./**/logs-*.tar.xz
gh-pages:
needs: build
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: ipk-*
- name: Prepare files
run: |
mkdir public
find . -name 'ipk-*.tar' -exec tar xvf -C public {} \;
- name: Deploy to GH pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
full_commit_message: 'Deploy ${{ needs.build.outputs.tag }}'
force_orphan: true
release:
needs: [build, gh-pages]
permissions:
contents: write
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
branch: ['23.05']
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: ipk-*
- name: Prepare files
env:
BRANCH: ${{ matrix.branch }}
run: |
find . -name "ipk-openwrt-${BRANCH}-*.tar" -exec tar -xvf {} --wildcards '*.ipk' \;
- name: Upload release assets
uses: ncipollo/release-action@v1
with:
allowUpdates: true
prerelease: false
tag: ${{ needs.build.outputs.tag }}-${{ matrix.branch }}
name: ${{ needs.build.outputs.tag }} for OpenWrt ${{ matrix.branch }}
artifacts: ./**/*.ipk