|
| 1 | +name: iPXE |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - ipxe* |
| 7 | + tags: |
| 8 | + - ipxe* |
| 9 | + |
| 10 | +env: |
| 11 | + SHIMURL: ${{ github.server_url }}/rhboot/shim |
| 12 | + IPXEURL: ${{ github.server_url }}/${{ github.repository }} |
| 13 | + |
| 14 | +jobs: |
| 15 | + |
| 16 | + build: |
| 17 | + name: Build |
| 18 | + runs-on: ubuntu-22.04 |
| 19 | + steps: |
| 20 | + |
| 21 | + - name: Check out code |
| 22 | + uses: actions/checkout@v3 |
| 23 | + with: |
| 24 | + fetch-depth: 0 |
| 25 | + submodules: true |
| 26 | + |
| 27 | + - name: Identify upstream tag |
| 28 | + run: | |
| 29 | + BASECOMMIT=$(git merge-base origin/main HEAD) |
| 30 | + SHIMTAG=$(git describe ${BASECOMMIT}) |
| 31 | + if [ ! $(git tag -l "${SHIMTAG}") ] ; then |
| 32 | + echo "Not branched from an upstream tag" |
| 33 | + exit 1 |
| 34 | + fi |
| 35 | + echo SHIMTAG=${SHIMTAG} >> ${GITHUB_ENV} |
| 36 | +
|
| 37 | + - name: Install packages |
| 38 | + run: | |
| 39 | + sudo apt update |
| 40 | + sudo apt install -y -o Acquire::Retries=50 \ |
| 41 | + gcc-aarch64-linux-gnu gcab dos2unix |
| 42 | +
|
| 43 | + - name: Build (x64) |
| 44 | + run: | |
| 45 | + mkdir build-x64 |
| 46 | + make -C build-x64 -f ../Makefile TOPDIR=.. |
| 47 | + cp build-x64/shimx64.efi ipxe-shimx64.efi |
| 48 | +
|
| 49 | + - name: Build (aa64) |
| 50 | + run: | |
| 51 | + mkdir build-aa64 |
| 52 | + make -C build-aa64 -f ../Makefile TOPDIR=.. \ |
| 53 | + CROSS_COMPILE=aarch64-linux-gnu- |
| 54 | + cp build-aa64/shimaa64.efi ipxe-shimaa64.efi |
| 55 | +
|
| 56 | + - name: Generate .cab |
| 57 | + run: | |
| 58 | + gcab -c unsigned.cab ipxe-shimx64.efi ipxe-shimaa64.efi |
| 59 | +
|
| 60 | + - name: Upload build artifacts |
| 61 | + uses: actions/upload-artifact@v3 |
| 62 | + with: |
| 63 | + name: unsigned.cab |
| 64 | + path: unsigned.cab |
| 65 | + if-no-files-found: error |
| 66 | + |
| 67 | + - name: Get release version |
| 68 | + if: startsWith(github.event.ref, 'refs/tags/ipxe-') |
| 69 | + run: | |
| 70 | + IPXETAG=${GITHUB_REF/refs\/tags\//} |
| 71 | + IPXEVER=${IPXETAG/ipxe-/} |
| 72 | + IPXEDATE=$(git show -s --format='%as') |
| 73 | + echo IPXETAG=${IPXETAG} >> ${GITHUB_ENV} |
| 74 | + echo IPXEVER=${IPXEVER} >> ${GITHUB_ENV} |
| 75 | + echo IPXEDATE=${IPXEDATE} >> ${GITHUB_ENV} |
| 76 | +
|
| 77 | + - name: Generate changelog |
| 78 | + run: | |
| 79 | + echo -e "Based on upstream" \ |
| 80 | + "[shim-${SHIMTAG}](${SHIMURL}/releases/tag/${SHIMTAG})\n" \ |
| 81 | + > IPXECHANGES.md |
| 82 | + echo -e "## Included changes\n" >> IPXECHANGES.md |
| 83 | + git log origin/main..HEAD \ |
| 84 | + --format="format:* [%s](${IPXEURL}/commit/%h)" >> IPXECHANGES.md |
| 85 | + DOWNLOADURL=${IPXEURL}/releases/download/${IPXETAG} |
| 86 | + echo -e "\n\n## Downloads\n" >> IPXECHANGES.md |
| 87 | + echo "* [ipxe-shimx64.efi](${DOWNLOADURL}/ipxe-shimx64.efi)" \ |
| 88 | + "(x86_64)" >> IPXECHANGES.md |
| 89 | + echo "* [ipxe-shimaa64.efi](${DOWNLOADURL}/ipxe-shimaa64.efi)" \ |
| 90 | + "(aarch64)" >> IPXECHANGES.md |
| 91 | +
|
| 92 | + - name: Create release |
| 93 | + if: startsWith(github.event.ref, 'refs/tags/ipxe-') |
| 94 | + env: |
| 95 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 96 | + run: | |
| 97 | + gh release create ${IPXETAG} --verify-tag --prerelease \ |
| 98 | + --title "${IPXEVER} (${IPXEDATE})" --notes-file IPXECHANGES.md \ |
| 99 | + ipxe-shimx64.efi ipxe-shimaa64.efi unsigned.cab |
0 commit comments