Skip to content

Commit f3411b6

Browse files
committed
update workflow
1 parent 997bf44 commit f3411b6

File tree

3 files changed

+44
-47
lines changed

3 files changed

+44
-47
lines changed

.github/workflows/main.yml

Lines changed: 39 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,57 @@ name: "Auto compile with OpenWrt SDK"
22
on:
33
workflow_dispatch:
44
push:
5-
paths:
6-
- 'qmodem/luci/luci-app-qmodem/Makefile'
5+
tags:
6+
- 'v*'
7+
branches:
8+
- main
79

810
env:
911
TZ: Asia/Shanghai
1012

1113
jobs:
1214
job_prepare:
13-
name: Prepare
1415
runs-on: ubuntu-latest
1516
outputs:
16-
git_tag: ${{ steps.set_git_tag.outputs.git_tag }}
17-
is_latest: ${{ steps.cache-version.outputs.cache-hit }}
17+
branch_name: ${{ env.branch_name }}
18+
tag_name: ${{ env.tag_name }}
19+
push_type: ${{ env.push_type }}
20+
tag_message: ${{ env.tag_message }}
21+
1822
steps:
19-
- name: Checkout
20-
uses: actions/checkout@v2
21-
with:
22-
path: 'qmodem'
23-
24-
- name: Set git tag
25-
id: set_git_tag
26-
run: |
27-
pkg_version=$(grep -oP '^PKG_VERSION:=\K.*' qmodem/luci/luci-app-qmodem/Makefile)
28-
if [ -z "$pkg_version" ]; then
29-
echo "PKG_VERSION not found in Makefile"
30-
exit 1
31-
fi
32-
echo "Extracted PKG_VERSION: $pkg_version"
33-
tag="v$pkg_version"
34-
echo "git_tag=$tag" >> $GITHUB_OUTPUT
35-
echo "git_tag=$tag"
36-
echo "git_tag=$tag" >> cache-version
37-
38-
- name: Cache Version
39-
id: cache-version
40-
uses: actions/cache@v3
41-
with:
42-
path: cache-version
43-
key: qmodem-version
23+
- name: Determine push type
24+
run: |
25+
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
26+
echo "This is a tag push."
27+
echo "tag_name=${{ github.ref_name }}" >> $GITHUB_ENV
28+
echo "push_type=tag" >> $GITHUB_ENV
29+
else
30+
echo "This is a branch push."
31+
echo "branch_name=${{ github.ref_name }}" >> $GITHUB_ENV
32+
echo "push_type=branch" >> $GITHUB_ENV
33+
fi
34+
35+
- name: Checkout
36+
if:
37+
uses: actions/checkout@v2
38+
with:
39+
path: 'qmodem'
40+
41+
- name: Get tag info
42+
id: get_tag_info
43+
run: |
44+
cd qmodem
45+
TAG_MESSAGE=$(git for-each-ref refs/tags/${{ env.tag_name }} --format='%(contents)')
46+
echo "tag_message=${TAG_MESSAGE}" >> $GITHUB_ENV
47+
4448
4549
job_build_qmodem:
4650
name: Build QModem
4751
needs: job_prepare
4852
continue-on-error: true
4953
strategy:
5054
matrix:
51-
build_arch: ['arm64_ipk',"arm64_apk"]
55+
build_arch: ['arm64_ipk',"arm64_apk","x64_apk","x64_ipk" ]
5256
runs-on: ubuntu-latest
5357
steps:
5458
- name: Install packages
@@ -156,23 +160,11 @@ jobs:
156160
fi
157161
done
158162
159-
- name: Check Release type
160-
run: |
161-
if [[ "${GITHUB_REF}" == *"-beta" ]]; then
162-
echo "Release type: beta"
163-
echo "RELEASE_TYPE=beta" >> $GITHUB_ENV
164-
elif [[ "${GITHUB_REF}" == *"-rc" ]]; then
165-
echo "Release type: rc"
166-
echo "RELEASE_TYPE=rc" >> $GITHUB_ENV
167-
else
168-
echo "Release type: release"
169-
echo "RELEASE_TYPE=release" >> $GITHUB_ENV
170-
fi
171-
172163
- name: Create GitHub Release
173164
uses: softprops/action-gh-release@v2
174-
if: ${{ needs.job_prepare.outputs.is_latest == 'true' }}
165+
if: ${{ needs.job_prepare.outputs.push_type == 'tag' }}
175166
with:
176-
tag_name: ${{ needs.job_prepare.outputs.git_tag }}
177-
prerelease: false
167+
body: ${{ needs.job_prepare.outputs.tag_message }}
168+
tag_name: ${{ needs.job_prepare.outputs.tag_name }}
169+
prerelease: ${{ needs.job_prepare.outputs.tag_name == '*-beta' || needs.job_prepare.outputs.tag_name == '*-rc' }}
178170
files: releases/*
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
SDK_NAME=openwrt-sdk-x86-64_gcc-13.3.0_musl.Linux-x86_64
22
SDK_URL=https://downloads.openwrt.org/snapshots/targets/x86/64/
33
SDK_ARCH=x86_64
4+
SDK_EXT=tar.zst

.github/workflows/x64_ipk.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SDK_NAME=openwrt-sdk-23.05.5-x86-64_gcc-12.3.0_musl.Linux-x86_64
2+
SDK_URL=https://downloads.openwrt.org/releases/23.05.5/targets/x86/64/
3+
SDK_ARCH=x86_64
4+
SDK_EXT=tar.xz

0 commit comments

Comments
 (0)