Skip to content

Generate x86_64 OpenWrt Firmware #8

Generate x86_64 OpenWrt Firmware

Generate x86_64 OpenWrt Firmware #8

# This is a basic workflow to help you get started with Actions
name: Generate x86_64 OpenWrt Firmware
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
release:
description: 将编译出的镜像上传到 Release
required: false
default: 'false'
env:
DOWNLOAD_BASE: https://downloads.immortalwrt.org
VENDOR: immortalwrt
VERSION: 23.05.1
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
Generate:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Initialization Environment
run: |
sudo apt-get -qq update
sudo apt-get -qq install build-essential libncurses5-dev libncursesw5-dev zlib1g-dev gawk git gettext libssl-dev xsltproc rsync wget unzip qemu-utils mkisofs
- name: Setup Environment Variables
run: |
echo "DATE=$(date +%Y%m%d)" >> $GITHUB_ENV
echo "DATETIME=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v3
with:
path: origin
- name: Download Image Builder
run: |
wget $DOWNLOAD_BASE/releases/$VERSION/targets/x86/64/$VENDOR-imagebuilder-$VERSION-x86-64.Linux-x86_64.tar.xz
tar -xvf $VENDOR-imagebuilder-$VERSION-x86-64.Linux-x86_64.tar.xz
rm -rf $VENDOR-imagebuilder-$VERSION-x86-64.Linux-x86_64.tar.xz
cp -r $GITHUB_WORKSPACE/origin/* $GITHUB_WORKSPACE/$VENDOR-imagebuilder-$VERSION-x86-64.Linux-x86_64/
- name: Download External Packages
working-directory: ${{ env.VENDOR }}-imagebuilder-${{ env.VERSION }}-x86-64.Linux-x86_64
run: |
cat external-package-urls.txt | xargs wget -P packages
- name: Run Patch and DIY Scripts
working-directory: ${{ env.VENDOR }}-imagebuilder-${{ env.VERSION }}-x86-64.Linux-x86_64
run: |
bash scripts/builder-patch.sh
bash scripts/clash.sh
bash scripts/zsh.sh
- name: Generate Firmware
working-directory: ${{ env.VENDOR }}-imagebuilder-${{ env.VERSION }}-x86-64.Linux-x86_64
run: |
bash build.sh
- name: Upload VDI Image For Development Purpose
if: github.ref == 'refs/heads/dev'
uses: nmerget/upload-gzip-artifact@v1.0.0
with:
name: ${{ env.VENDOR }}-${{ env.VERSION }}-x86_64-vdi-image-${{ env.DATETIME }}
path: ${{ env.VENDOR }}-imagebuilder-${{ env.VERSION }}-x86-64.Linux-x86_64/bin/targets/x86/64/*.vdi
- name: Upload All Firmware to Artifacts
uses: nmerget/upload-gzip-artifact@v1.0.0
with:
name: ${{ env.VENDOR }}-${{ env.VERSION }}-x86_64-images-${{ env.DATETIME }}
path: ${{ env.VENDOR }}-imagebuilder-${{ env.VERSION }}-x86-64.Linux-x86_64/bin/targets/x86/64/*
- name: Upload Firmware to Release
if: github.event.inputs.release == 'true'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
file: ${{ env.VENDOR }}-imagebuilder-${{ env.VERSION }}-x86-64.Linux-x86_64/bin/targets/x86/64/*
asset_name: ${{ github.event.repository.name }}-${{ github.sha }}
tag: release-${{ env.DATE }}
overwrite: true