multiarch-build.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. name: Build Release
  2. on:
  3. push:
  4. tags:
  5. - v*
  6. jobs:
  7. build-releases:
  8. strategy:
  9. matrix:
  10. arch: ["linux/amd64 x86_64", "linux/arm/v7 armv7h", "linux/arm64 aarch64"]
  11. name: Build ${{ matrix.arch }}
  12. runs-on: ubuntu-latest
  13. steps:
  14. - name: Checkout code
  15. uses: actions/checkout@v4
  16. with:
  17. fetch-depth: 0
  18. - name: Set up QEMU
  19. uses: docker/setup-qemu-action@v3
  20. - name: Set up Docker Buildx
  21. uses: docker/setup-buildx-action@v3
  22. - name: Login to Docker Hub
  23. uses: docker/login-action@v3
  24. with:
  25. username: ${{ secrets.DOCKERHUB_USERNAME }}
  26. password: ${{ secrets.DOCKERHUB_TOKEN }}
  27. - name: Read info
  28. id: tags
  29. run: |
  30. echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
  31. echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
  32. arch="${{ matrix.arch }}"
  33. echo "PLATFORM=${arch%% *}" >> $GITHUB_OUTPUT
  34. echo "ARCH=${arch##* }" >> $GITHUB_OUTPUT
  35. - name: Build ${{ matrix.arch }} release
  36. run: |
  37. mkdir artifacts
  38. docker buildx build --platform ${{ steps.tags.outputs.platform }} \
  39. --build-arg VERSION=${{ steps.tags.outputs.version }} \
  40. --build-arg ARCH=${{ steps.tags.outputs.arch }} \
  41. --build-arg PREFIX="/usr" \
  42. -t yay:${{ steps.tags.outputs.arch }} . --load
  43. make docker-release ARCH=${{ steps.tags.outputs.arch }} VERSION=${{ steps.tags.outputs.version }} PREFIX="/usr"
  44. mv *.tar.gz artifacts
  45. - uses: actions/upload-artifact@v4
  46. with:
  47. name: yay_${{ steps.tags.outputs.arch }}
  48. path: artifacts
  49. create_release:
  50. name: Create release from this build
  51. needs: [build-releases]
  52. runs-on: ubuntu-latest
  53. permissions:
  54. contents: write
  55. steps:
  56. - name: Checkout
  57. uses: actions/checkout@v4
  58. with:
  59. fetch-depth: 0
  60. - name: Read info
  61. id: tags
  62. run: |
  63. echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
  64. echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
  65. - uses: actions/download-artifact@v4
  66. with:
  67. pattern: yay_*
  68. merge-multiple: true
  69. - name: Create Release
  70. env:
  71. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  72. run: |
  73. gh release create ${{ steps.tags.outputs.tag }} \
  74. --title "${{ steps.tags.outputs.tag }}" \
  75. --generate-notes \
  76. ./yay_${{ steps.tags.outputs.version }}_*.tar.gz
  77. - name: Release Notary Action
  78. uses: docker://aevea/release-notary:latest
  79. env:
  80. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}