Skip to content

Commit ccff179

Browse files
committed
Update lkms.yml workflow file
1 parent 7275923 commit ccff179

File tree

1 file changed

+158
-0
lines changed

1 file changed

+158
-0
lines changed

.github/workflows/lkms.yml

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
#
2+
# Copyright (C) 2022 Ing <https://github.com/wjz304>
3+
#
4+
# This is free software, licensed under the MIT License.
5+
# See /LICENSE for more information.
6+
#
7+
8+
name: Build lkms
9+
10+
on:
11+
workflow_dispatch:
12+
inputs:
13+
version:
14+
description: "format %y.%-m.$i or auto"
15+
required: false
16+
type: string
17+
prerelease:
18+
description: "pre release"
19+
default: false
20+
type: boolean
21+
22+
jobs:
23+
build:
24+
strategy:
25+
matrix:
26+
include:
27+
- version: 7.1
28+
platform: armada37xx
29+
#- version: 7.1
30+
# platform: armada38x
31+
- version: 7.1
32+
platform: rtd1296
33+
- version: 7.1
34+
platform: rtd1619b
35+
36+
- version: 7.2
37+
platform: armada37xx
38+
#- version: 7.2
39+
# platform: armada38x
40+
- version: 7.2
41+
platform: rtd1296
42+
- version: 7.2
43+
platform: rtd1619b
44+
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@main
49+
50+
- name: Checkout
51+
uses: actions/checkout@main
52+
with:
53+
repository: RROrg/rr-lkms
54+
token: ${{ secrets.RRORG }}
55+
path: rrr-lkms
56+
57+
- name: Init Env
58+
run: |
59+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
60+
git config --global user.name "github-actions[bot]"
61+
sudo timedatectl set-timezone "Asia/Shanghai"
62+
63+
- name: Make lkms
64+
run: |
65+
ROOT_PATH=${{ github.workspace }}
66+
VERSION=${{ matrix.version }}
67+
PLATFORM=${{ matrix.platform }}
68+
69+
. ${ROOT_PATH}/rrr-lkms/compile.sh
70+
71+
echo "makeEnvDeploy"
72+
makeEnvDeploy "${ROOT_PATH}" "${VERSION}" "${PLATFORM}"
73+
74+
echo "makemodules"
75+
makelkms "${ROOT_PATH}" "${VERSION}" "${PLATFORM}" "${ROOT_PATH}/rrr-lkms" "${ROOT_PATH}/output"
76+
77+
- name: Upload to Artifacts
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: rp-lkms-${{ matrix.version }}-${{ matrix.platform }}
81+
path: |
82+
output/*
83+
84+
release:
85+
runs-on: ubuntu-latest
86+
needs: build
87+
steps:
88+
- name: Checkout
89+
uses: actions/checkout@main
90+
91+
- name: Init Env
92+
run: |
93+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
94+
git config --global user.name "github-actions[bot]"
95+
sudo timedatectl set-timezone "Asia/Shanghai"
96+
97+
- name: Calculate version
98+
run: |
99+
# Calculate version
100+
VERSION=""
101+
if [ -n "${{ inputs.version }}" ]; then
102+
if [ "$(echo ${{ inputs.version }} | cut -d '.' -f 1,2)" = "$(date +'%y.%-m')" ]; then
103+
VERSION="${{ inputs.version }}"
104+
else
105+
LATEST_TAG="$(curl -skLH "Authorization: token ${{ secrets.RRORG }}" "https://api.github.com/repos/RROrg/rrr-lkms/releases" | jq -r ".[0].tag_name" 2>/dev/null)"
106+
if [ -n "${LATEST_TAG}" -a "$(echo ${LATEST_TAG} | cut -d '.' -f 1,2)" = "$(date +'%y.%-m')" ]; then # format %y.%-m.$i
107+
VERSION="$(echo ${LATEST_TAG} | awk -F '.' '{$3=$3+1}1' OFS='.')"
108+
else
109+
VERSION="$(date +'%y.%-m').0"
110+
fi
111+
fi
112+
else
113+
VERSION=""
114+
fi
115+
116+
echo "VERSION: ${VERSION}"
117+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
118+
119+
- name: download to artifacts
120+
uses: actions/download-artifact@v4
121+
with:
122+
path: output
123+
pattern: rp-lkms-*
124+
merge-multiple: true
125+
126+
- name: delete-artifact
127+
uses: geekyeggo/delete-artifact@v5
128+
with:
129+
name: |
130+
rp-lkms-*
131+
132+
- name: Zip lkms
133+
run: |
134+
VERSION="${{ env.VERSION }}"
135+
VERSION="${VERSION:-"test"}"
136+
137+
echo "${VERSION}" > "output/VERSION"
138+
zip -9 rp-lkms-${VERSION}.zip -j output/*
139+
140+
- name: Upload to Artifacts
141+
if: success() && env.VERSION == ''
142+
uses: actions/upload-artifact@v4
143+
with:
144+
name: rp-lkms
145+
path: |
146+
rp-lkms*.zip
147+
retention-days: 5
148+
149+
- name: Release
150+
if: success() && env.VERSION != ''
151+
uses: ncipollo/release-action@v1
152+
with:
153+
tag: ${{ env.VERSION }}
154+
prerelease: ${{ inputs.prerelease }}
155+
artifacts: rp-lkms*.zip
156+
owner: RROrg
157+
repo: rrr-lkms
158+
token: ${{ secrets.RRORG }}

0 commit comments

Comments
 (0)