Skip to content

Merge pull request #1 from penalte/branch-and-pr-test #99

Merge pull request #1 from penalte/branch-and-pr-test

Merge pull request #1 from penalte/branch-and-pr-test #99

Workflow file for this run

name: Build OpenWrt-ICE-T
on:
push:
branches: [ "main" ]
tags: [ "*" ] # Trigger on tag pushes
pull_request:
branches: [ "main" ]
permissions:
contents: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Ensures full commit history for changelog
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
# Install makeself
wget https://github.com/megastep/makeself/releases/download/release-2.5.0/makeself-2.5.0.run
chmod +x makeself-2.5.0.run
./makeself-2.5.0.run
sudo mv makeself-2.5.0/makeself.sh /usr/local/bin/makeself
sudo mv makeself-2.5.0/makeself-header.sh /usr/local/bin/
- name: Run ShellCheck
run: |
shellcheck src/openwrt-ice-t.sh
find src/lib -type f -name "*.sh" -exec shellcheck {} \;
- name: Prepare build directory
run: |
mkdir -p build
cp -r src/* build/
chmod +x build/openwrt-ice-t.sh
- name: Extract version from tag
if: startsWith(github.ref, 'refs/tags/')
id: extract_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Set development version
if: "!startsWith(github.ref, 'refs/tags/')"
run: echo "VERSION=dev-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Debug Print environment variables
run: env
- name: Debug List build directory contents
run: ls -la build
- name: Replace VERSION in openwrt-ice-t.sh
run: |
sed -i 's/VERSION="Development"/VERSION="${{ env.VERSION }}"/' build/openwrt-ice-t.sh
- name: Create self-extracting archive
run: |
echo "VERSION=${{ env.VERSION }}"
makeself build/ "openwrt-ice-t.run" "OpenWrt ICE-T ${{ env.VERSION }}" ./openwrt-ice-t.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: openwrt-ice-t
path: "openwrt-ice-t.run"
- name: Generate changelog
if: startsWith(github.ref, 'refs/tags/')
id: changelog
uses: mikepenz/release-changelog-builder-action@v5
with:
configuration: .github/release-changelog-config.json
- name: Debug Changelog Output
if: startsWith(github.ref, 'refs/tags/')
run: echo "${{ steps.changelog.outputs.changelog }}"
- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: "openwrt-ice-t.run"
body: ${{ steps.changelog.outputs.changelog || 'No changelog available.' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}