Skip to content

Build all target

Build all target #22

Workflow file for this run

name: Build all target
on:
workflow_dispatch:
inputs:
openwrt_tag:
type: string
jobs:
setup:
name: Setup
runs-on: self-hosted
outputs:
targets: ${{ steps.find_targets.outputs.targets }}
targets_subtargets: ${{ steps.find_targets.outputs.targets_subtargets }}
openwrt_tag: ${{ steps.set_env.outputs.openwrt_tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set env
id: set_env
run: |
openwrt_tag=${{ inputs.openwrt_tag }}
[ -n "${openwrt_tag}" ] || openwrt_tag=$(curl -sL https://github.com/openwrt/openwrt | sed -n 's/.*\/openwrt\/openwrt\/releases\/tag\/\(.*\)">/\1/p')
echo "openwrt_tag=${openwrt_tag}" >> "$GITHUB_OUTPUT"
- name: Set targets
id: find_targets
run: python3 -B ./.github/workflows/scripts/get_targets.py | while read v;do echo "$v" >> "$GITHUB_OUTPUT"; done
build:
name: Build target
needs: setup
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.setup.outputs.targets_subtargets)}}
uses: ./.github/workflows/build.yml
with:
target: ${{ matrix.target }}
subtarget: ${{ matrix.subtarget }}
output_image_type: ${{ matrix.output_image_type }}
openwrt_tag: ${{ needs.setup.outputs.openwrt_tag }}
release:
name: Release
runs-on: self-hosted
needs: [setup,build]
steps:
- name: Set tag
run: |
openwrt_tag=${{ needs.setup.outputs.openwrt_tag }}
if [ -n "$(git ls-remote --tags origin | grep \"${openwrt_tag}\")" ];then
git push origin --delete ${openwrt_tag}
fi
- name: Release file
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.setup.outputs.openwrt_tag }}
files: /data/openwrt/artifact/openwrt-*.img.gz