-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (77 loc) · 2.72 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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 }}