|
| 1 | +name: Refresh Intel µcode submodule |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # At 23:35 on every day-of-week from Sunday through Saturday |
| 6 | + # https://crontab.guru/#35_23_*_*_0-6 |
| 7 | + - cron: '35 23 * * 0-6' |
| 8 | + workflow_dispatch: |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - dasharo |
| 12 | + |
| 13 | +jobs: |
| 14 | + check: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout Code |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Check if µcode submodule is up to date |
| 22 | + run: | |
| 23 | + git submodule update --init --checkout 3rdparty/intel-microcode |
| 24 | + pushd 3rdparty/intel-microcode |
| 25 | + current=$(git log -1 --pretty=format:"%H") |
| 26 | + git checkout main~ |
| 27 | + git pull |
| 28 | + new=$(git log -1 --pretty=format:"%H") |
| 29 | + if [[ $current == $new ]]; then |
| 30 | + echo "Intel µcode submodule is up-to-date." |
| 31 | + else |
| 32 | + echo "Intel µcode submodule is out of date!" |
| 33 | + exit 1 |
| 34 | + fi |
| 35 | + popd |
| 36 | +
|
| 37 | + update: |
| 38 | + runs-on: ubuntu-latest |
| 39 | + needs: check |
| 40 | + if: | |
| 41 | + always() && needs.check.result == 'failure' |
| 42 | +
|
| 43 | + steps: |
| 44 | + - name: Checkout Code |
| 45 | + uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - name: Update µcode submodule |
| 48 | + run: | |
| 49 | + git submodule update --init --checkout 3rdparty/intel-microcode |
| 50 | + pushd 3rdparty/intel-microcode |
| 51 | + git checkout main~ |
| 52 | + git pull |
| 53 | + popd |
| 54 | +
|
| 55 | + - name: Set current date |
| 56 | + run: | |
| 57 | + pushd 3rdparty/intel-microcode |
| 58 | + echo "RELEASE_DATE=$(git log -1 --pretty='format:%cs')" >> ${GITHUB_ENV} |
| 59 | + popd |
| 60 | +
|
| 61 | + - name: Submit pull request |
| 62 | + uses: peter-evans/create-pull-request@v7.0.7 |
| 63 | + with: |
| 64 | + base: dasharo |
| 65 | + branch: update_ucode_${{ env.RELEASE_DATE }} |
| 66 | + title: Update µcode ${{ env.RELEASE_DATE }} |
| 67 | + commit-message: "[automated change] Update µcode ${{ env.RELEASE_DATE }}" |
| 68 | + |
| 69 | + |
| 70 | + |
0 commit comments