Skip to content

Build and Upload

Build and Upload #72

Workflow file for this run

name: Build and Upload
on:
workflow_dispatch:
env:
PACKAGES: xupnpd2-fork http-to-https-proxy watchyourlan
PACKAGES_NOHF: http-to-https-proxy watchyourlan
jobs:
build:
concurrency: build-${{ github.ref_name || github.run_id }}-${{ matrix.config }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.allow-failure }}
strategy:
fail-fast: false
matrix:
include:
- config: aarch64-3.10
dir: aarch64-k3.10
allow-failure: false
#- config: armv5-3.2 # EOS
# dir: armv5sf-k3.2
# allow-failure: true
#- config: armv7-2.6 # EOS
# dir: armv7sf-k2.6
# allow-failure: true
- config: armv7-3.2
dir: armv7sf-k3.2
allow-failure: false
- config: mipsel-3.4
dir: mipselsf-k3.4
allow-failure: true
- config: mips-3.4
dir: mipssf-k3.4
allow-failure: true
- config: x64-3.2
dir: x64-k3.2
allow-failure: false
#- config: x86-2.6 # EOS
# dir: x86-k2.6
# allow-failure: true
steps:
- uses: actions/checkout@v4
with:
repository: Entware/Entware
- name: Setup dependencies
run: |
sudo apt-get update
sudo apt-get install build-essential flex gawk gcc-multilib gettext git libncurses5-dev libssl-dev python2 python-is-python3 python3-distutils subversion unzip zlib1g-dev rsync
- name: Activate platform configuration
run: ln -s configs/${{ matrix.config }}.config .config
- name: Get commit hash for cache key
id: hash
run: echo "RESULT=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@v4
continue-on-error: true
id: restore-cache
with:
path: |
bin
build_dir
staging_dir
key: ${{ matrix.config }}-${{ steps.hash.outputs.RESULT }}
- name: Build tools and toolchain
if: steps.restore-cache.outputs.cache-hit != 'true'
run: |
make tools/install -j$(nproc) ${{ vars.TOOLCHAIN_EXTRA_COMPILE_ARGUMENTS || '' }}
make toolchain/install -j$(nproc) ${{ vars.TOOLCHAIN_EXTRA_COMPILE_ARGUMENTS || '' }}
make target/compile -j$(nproc) ${{ vars.TOOLCHAIN_EXTRA_COMPILE_ARGUMENTS || '' }}
- uses: actions/cache/save@v4
continue-on-error: true
if: steps.restore-cache.outputs.cache-hit != 'true'
with:
path: |
bin
build_dir
staging_dir
key: ${{ matrix.config }}-${{ steps.hash.outputs.RESULT }}
- name: Fetch feeds
run: |
echo "src-git jacklul https://github.com/jacklul/entware-packages.git" >> feeds.conf
make package/symlinks
- name: Build packages
if: env.PACKAGES != ''
continue-on-error: ${{ matrix.allow-failure }}
run: |
for PACKAGE in ${{ env.PACKAGES }}; do echo "CONFIG_PACKAGE_${PACKAGE}=m" >> .config ; done
for PACKAGE in ${{ env.PACKAGES }}; do make package/$PACKAGE/compile -j$(nproc) ${{ vars.PACKAGES_EXTRA_COMPILE_ARGUMENTS || '' }} ${{ matrix.allow-failure && '|| true' || '' }} ; done
- name: Build packages ("nohf" variants)
if: env.PACKAGES_NOHF != '' && (matrix.config == 'armv7-2.6' || matrix.config == 'armv7-3.2')
continue-on-error: ${{ matrix.allow-failure }}
run: |
for PACKAGE in ${{ env.PACKAGES_NOHF }}; do echo "CONFIG_PACKAGE_${PACKAGE}_nohf=m" >> .config ; done
for PACKAGE in ${{ env.PACKAGES_NOHF }}; do BUILD_VARIANT=nohf make package/$PACKAGE/compile -j$(nproc) ${{ vars.PACKAGES_EXTRA_COMPILE_ARGUMENTS || '' }} ${{ matrix.allow-failure && '|| true' || '' }} ; done
- name: Copy packages to artifact directory
run: |
mkdir -v artifact
for PACKAGE in ${{ env.PACKAGES }}; do cp -fv bin/targets/*/*/packages/$PACKAGE* artifact || true; done
- uses: actions/checkout@v4
with:
repository: Entware/ipk-html-indexer
path: ipk-html-indexer
- name: Run ipk-html-indexer
run: |
sudo ln -sv "$GITHUB_WORKSPACE/ipk-html-indexer/mkindex.py" /usr/local/bin/mkindex.py
sudo ln -sv "$GITHUB_WORKSPACE/ipk-html-indexer/mkhtml.py" /usr/local/bin/mkhtml.py
bash ipk-html-indexer/index_feed.sh -h -f artifact
sed 's#href="/css#href="../css#' -i artifact/Packages.html
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.dir }}
path: artifact/*
retention-days: 1
upload:
concurrency: upload-${{ github.ref_name || github.run_id }}
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
continue-on-error: true
with:
ref: gh-pages
- uses: actions/checkout@v4
with:
repository: Entware/ipk-html-indexer
path: ipk-html-indexer
- name: Copy ipk-html-indexer's css directory
run: |
rm -fr ./css
cp -rfv ipk-html-indexer/css .
- name: Remove existing content
run: find . -mindepth 1 -maxdepth 1 \( ! -name ".git" ! -name "css" -type d -exec rm -fr "{}" \; \) -o \( -type f -exec rm -f "{}" \; \)
- uses: actions/download-artifact@v4
- name: Move .git and css directories out
shell: bash
run: |
mv .git ../.git.bak
mv css ../css.bak
- name: Generate directory listings
uses: jayanta525/github-pages-directory-listing@v4.0.0
with:
FOLDER: .
- name: Fix permissions of index.html files
run: find . -type f -name index.html -exec sudo chown $(id -u):$(id -g) {} \;
- name: Move .git and css directories back
shell: bash
run: |
mv ../.git.bak .git
mv ../css.bak css
- name: Rename gh-pages branch
continue-on-error: true
run: git branch -m gh-pages gh-pages.old
- uses: JamesIves/github-pages-deploy-action@v4
if: ${{ github.ref_name == 'master' }}
with:
branch: gh-pages
folder: .
commit-message: Upload
single-commit: true
force: true
- run: rm -fr .git
if: ${{ github.ref_name != 'master' }}
- uses: actions/upload-artifact@v4
if: ${{ github.ref_name != 'master' }}
with:
name: upload
path: .