-
Notifications
You must be signed in to change notification settings - Fork 149
90 lines (86 loc) · 3.22 KB
/
Copy pathbuild-linux-artifacts.yml
File metadata and controls
90 lines (86 loc) · 3.22 KB
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
name: Build Linux artifact
on:
push:
branches:
- master
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
detect-file-change:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: 'true'
- name: Test file change of Linux image
id: test-linux-image-version-change
uses: tj-actions/changed-files@v47
with:
files: |
assets/system/configs/*
tools/build-linux-image.sh
mk/external.mk
tests/system/br_pkgs/rtc/*.c
- name: Set alias
id: has_changed_files
run: |
if [[ ${{ steps.test-linux-image-version-change.outputs.any_modified }} == true ]]; then
# Determine if the changes are from the Buildroot patching or the Buildroot or the Linux version
# Others file changes need to trigger the rebuilt via workflow_dispatch event
echo -n $(git --no-pager diff HEAD^ HEAD | grep \
-e "assets/system/configs/" \
-e "tools/build-linux-image.sh" \
-e "tests/system/br_pkgs/rtc/" \
-e "+BUILDROOT_VERSION" \
-e "+LINUX_VERSION" \
-e "+LINUX_PATCHLEVEL" \
) >> linux-image-version-change
if [[ -s linux-image-version-change ]]; then
echo "has_changed_linux_image_version=true" >> $GITHUB_OUTPUT
else
echo "has_changed_linux_image_version=false" >> $GITHUB_OUTPUT
fi
else
echo "has_changed_linux_image_version=false" >> $GITHUB_OUTPUT
fi
outputs:
has_changed_linux_image_version: ${{ steps.has_changed_files.outputs.has_changed_linux_image_version }}
build-linux-image-artifact:
needs: [detect-file-change]
if: ${{ needs.detect-file-change.outputs.has_changed_linux_image_version == 'true' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: 'true'
- name: Install dependencies
run: |
sudo apt-get update -q=2
sudo apt-get upgrade -q=2
sudo apt-get install -q=2 build-essential git
- name: Build Linux image
run: |
make build-linux-image
make system_defconfig
make artifact ENABLE_PREBUILT=0
- name: Create tarball
run: |
cd /tmp
tar -zcvf rv32emu-linux-image-prebuilt.tar.gz rv32emu-linux-image-prebuilt
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.RV32EMU_PREBUILT_TOKEN }}
run: |
RELEASE_TAG="$(date +'%Y.%m.%d')-$(git rev-parse --short HEAD)-Linux-Image"
cd /tmp
gh release create --latest=false $RELEASE_TAG \
--repo sysprog21/rv32emu-prebuilt \
--title "$RELEASE_TAG"
gh release upload $RELEASE_TAG \
rv32emu-linux-image-prebuilt.tar.gz \
sha1sum-linux-image \
--repo sysprog21/rv32emu-prebuilt