|
27 | 27 | tests/quake/**
|
28 | 28 | tests/scimark2/**
|
29 | 29 | tests/*.c
|
| 30 | + - name: Test file change of Linux image |
| 31 | + id: test-linux-image-version-change |
| 32 | + uses: tj-actions/changed-files@v45 |
| 33 | + with: |
| 34 | + files: | |
| 35 | + mk/external.mk |
30 | 36 | - name: Set alias
|
31 | 37 | id: has_changed_files
|
32 | 38 | run: |
|
|
35 | 41 | else
|
36 | 42 | echo "has_changed_files=false" >> $GITHUB_OUTPUT
|
37 | 43 | fi
|
| 44 | + if [[ ${{ steps.test-linux-image-version-change.outputs.any_modified }} == true ]]; then |
| 45 | + # Determine if the changes are from Buildroot or the Linux version (The Linux might have several patches, so also need to check the SHA value) |
| 46 | + echo -n $(git --no-pager diff HEAD^ HEAD | grep -e "+BUILDROOT_VERSION" -e "+LINUX_VERSION" -e "+LINUX_DATA_SHA1") >> linux-image-version-change |
| 47 | + if [[ -s linux-image-version-change ]]; then |
| 48 | + echo "has_changed_linux_image_version=true" >> $GITHUB_OUTPUT |
| 49 | + else |
| 50 | + echo "has_changed_linux_image_version=false" >> $GITHUB_OUTPUT |
| 51 | + fi |
| 52 | + else |
| 53 | + echo "has_changed_linux_image_version=false" >> $GITHUB_OUTPUT |
| 54 | + fi |
38 | 55 | outputs:
|
39 | 56 | has_changed_files: ${{ steps.has_changed_files.outputs.has_changed_files }}
|
| 57 | + has_changed_linux_image_version: ${{ steps.has_changed_files.outputs.has_changed_linux_image_version }} |
| 58 | + |
| 59 | + build-linux-image-artifact: |
| 60 | + needs: [detect-file-change] |
| 61 | + if: ${{ needs.detect-file-change.outputs.has_changed_linux_image_version == 'true' || github.event_name == 'workflow_dispatch' }} |
| 62 | + runs-on: ubuntu-22.04 |
| 63 | + steps: |
| 64 | + - name: Checkout repository |
| 65 | + uses: actions/checkout@v4 |
| 66 | + with: |
| 67 | + submodules: 'true' |
| 68 | + - name: Install dependencies |
| 69 | + run: | |
| 70 | + sudo apt-get update -q -y |
| 71 | + sudo apt-get upgrade -q -y |
| 72 | + sudo apt-get install -q -y build-essential git |
| 73 | + - name: Build Linux image |
| 74 | + run: | |
| 75 | + make build-linux-image |
| 76 | + make artifact ENABLE_PREBUILT=0 ENABLE_SYSTEM=1 |
| 77 | + mkdir -p /tmp/rv32emu-linux-image-prebuilt/linux-image |
| 78 | + mv build/linux-image/Image /tmp/rv32emu-linux-image-prebuilt/linux-image |
| 79 | + mv build/linux-image/rootfs.cpio /tmp/rv32emu-linux-image-prebuilt/linux-image |
| 80 | + mv build/sha1sum-linux-image /tmp |
| 81 | + - name: Create tarball |
| 82 | + run: | |
| 83 | + cd /tmp |
| 84 | + tar -zcvf rv32emu-linux-image-prebuilt.tar.gz rv32emu-linux-image-prebuilt |
| 85 | + - name: Create GitHub Release |
| 86 | + env: |
| 87 | + GH_TOKEN: ${{ secrets.RV32EMU_PREBUILT_TOKEN }} |
| 88 | + run: | |
| 89 | + RELEASE_TAG=$(date +'%Y.%m.%d'-Linux-Image) |
| 90 | + cd /tmp |
| 91 | + gh release create $RELEASE_TAG \ |
| 92 | + --repo sysprog21/rv32emu-prebuilt \ |
| 93 | + --title "$RELEASE_TAG""-nightly" |
| 94 | + gh release upload $RELEASE_TAG \ |
| 95 | + rv32emu-linux-image-prebuilt.tar.gz \ |
| 96 | + sha1sum-linux-image \ |
| 97 | + --repo sysprog21/rv32emu-prebuilt |
40 | 98 |
|
41 | 99 | build-artifact:
|
42 | 100 | needs: [detect-file-change]
|
|
83 | 141 | env:
|
84 | 142 | GH_TOKEN: ${{ secrets.RV32EMU_PREBUILT_TOKEN }}
|
85 | 143 | run: |
|
86 |
| - RELEASE_TAG=$(date +'%Y.%m.%d') |
| 144 | + RELEASE_TAG=$(date +'%Y.%m.%d'-ELF) |
87 | 145 | cd /tmp
|
88 | 146 | gh release create $RELEASE_TAG \
|
89 | 147 | --repo sysprog21/rv32emu-prebuilt \
|
|
0 commit comments