chore(config): fix workflow #1
This file contains 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 | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
upload_release: | |
description: 'Whether to upload binaries to releases' | |
required: true | |
default: '0' | |
backup_dl_src: | |
description: 'Whether to backup downloaded sources to releases' | |
required: false | |
default: '0' | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
container: | |
image: pexcn/docker-images:bookworm-openwrt | |
volumes: | |
- /usr/local:/usr/local | |
- /usr/lib/google-cloud-sdk:/usr/lib/google-cloud-sdk | |
- /usr/share/dotnet:/usr/share/dotnet | |
- /usr/share/swift:/usr/share/swift | |
- /opt/az:/opt/az | |
- /opt/google:/opt/google | |
- /opt/microsoft:/opt/microsoft | |
- /opt/pipx:/opt/pipx | |
- /opt/hostedtoolcache:/opt/hostedtoolcache | |
env: | |
TZ: Asia/Taipei | |
BUILD_REPO: https://github.com/openwrt-ipq60xx/openwrt.git | |
BUILD_PROFILE: ${{ matrix.PROFILE }} | |
BACKUP_DL_SRC: ${{ github.event.inputs.backup_dl_src }} | |
strategy: | |
fail-fast: false | |
matrix: | |
PROFILE: | |
- qualcommax-ipq60xx | |
- qualcommax-ipq60xx_emmc | |
steps: | |
- name: Maximize disk space | |
uses: pexcn/maximize-disk-space@v1 | |
with: | |
use-system-docker: false | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Make build cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.ccache | |
/builder/.ccache | |
key: ${{ runner.os }}-${{ github.ref_name }}-${{ env.BUILD_PROFILE }}-${{ github.sha }} | |
restore-keys: ${{ runner.os }}-${{ github.ref_name }}-${{ env.BUILD_PROFILE }}- | |
- name: Build firmware | |
run: ./build.sh | |
- name: Upload to Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.BUILD_PROFILE }} | |
path: openwrt/bin | |
- name: Set release tag | |
run: echo "RELEASE_TAG=$(date +%Y%m%d)" >> $GITHUB_ENV | |
- name: Upload to Releases | |
if: (github.event_name == 'push' && startsWith(github.event.head_commit.message, '[release] ')) || (github.event.inputs.upload_release == 1) | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.RELEASE_TAG }} | |
files: ${{ env.BUILD_PROFILE }}.tar.gz | |
- name: Backup downloaded sources | |
if: (github.event_name == 'push' && startsWith(github.event.head_commit.message, '[release] ')) || (github.event.inputs.backup_dl_src == 1) | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.RELEASE_TAG }} | |
files: ${{ env.BUILD_PROFILE }}_dl-src.tar.gz |