build.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. name: Build
  2. on:
  3. push:
  4. branches: [main]
  5. tags: ['v*']
  6. pull_request:
  7. workflow_dispatch:
  8. jobs:
  9. steamworks-vote:
  10. runs-on: ubuntu-latest
  11. steps:
  12. - uses: actions/checkout@v7
  13. - uses: actions/setup-node@v7
  14. with:
  15. node-version: 22
  16. - name: Install clang for bindgen
  17. run: sudo apt-get update && sudo apt-get install -y clang libclang-dev
  18. - name: Build patched steamworks.js
  19. env:
  20. STEAMWORKSJS_BUILD: build
  21. run: bash patches/steamworks-vote/build.sh "$RUNNER_TEMP/src"
  22. - name: Pack
  23. run: |
  24. mkdir -p "$RUNNER_TEMP/out"
  25. cd "$RUNNER_TEMP/src/steamworksjs"
  26. npm pack --pack-destination "$RUNNER_TEMP/out"
  27. cp dist/linux64/steamworksjs.linux-x64-gnu.node dist/linux64/libsteam_api.so "$RUNNER_TEMP/out/"
  28. - uses: actions/upload-artifact@v7
  29. with:
  30. name: steamworks-vote
  31. path: ${{ runner.temp }}/out/*
  32. if-no-files-found: error
  33. we-manager:
  34. needs: steamworks-vote
  35. # still build the app when the patch build breaks, it just falls back to unconfirmed votes then
  36. if: ${{ !cancelled() }}
  37. runs-on: ubuntu-latest
  38. steps:
  39. - uses: actions/checkout@v7
  40. - uses: actions/setup-node@v7
  41. with:
  42. node-version: 22
  43. cache: npm
  44. - run: npm ci
  45. - uses: actions/download-artifact@v8
  46. if: ${{ needs.steamworks-vote.result == 'success' }}
  47. with:
  48. name: steamworks-vote
  49. path: ${{ runner.temp }}/steamworks-vote
  50. - name: Use patched steamworks.js
  51. if: ${{ needs.steamworks-vote.result == 'success' }}
  52. run: npm install --no-save "$RUNNER_TEMP"/steamworks-vote/steamworks.js-*.tgz
  53. - run: npm run build
  54. - run: npx electron-builder --linux --publish never
  55. - uses: actions/upload-artifact@v7
  56. with:
  57. name: we-manager
  58. path: |
  59. dist/*.AppImage
  60. dist/*.deb
  61. if-no-files-found: error
  62. # the app's .deb plus the engine's latest portable release, see packaging/flatpak
  63. flatpak:
  64. needs: we-manager
  65. runs-on: ubuntu-latest
  66. container:
  67. image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-25.08
  68. options: --privileged
  69. steps:
  70. - uses: actions/checkout@v7
  71. - uses: actions/download-artifact@v8
  72. with:
  73. name: we-manager
  74. path: ${{ runner.temp }}/we-manager
  75. - name: Collect sources
  76. run: |
  77. cp "$RUNNER_TEMP"/we-manager/*.deb packaging/flatpak/we-manager.deb
  78. url=$(curl -fsSL https://api.github.com/repos/WallpaperEngineLover/linux-wallpaperengine-kde/releases/latest |
  79. jq -r '.assets[] | select(.name == "linux-wallpaperengine-kde-portable-x86_64.tar.gz") | .browser_download_url')
  80. [ -n "$url" ] || { echo "the latest linux-wallpaperengine-kde release has no portable tarball"; exit 1; }
  81. curl -fL "$url" -o packaging/flatpak/linux-wallpaperengine-kde-portable-x86_64.tar.gz
  82. - uses: flatpak/flatpak-github-actions/flatpak-builder@v6
  83. with:
  84. bundle: we-manager.flatpak
  85. manifest-path: packaging/flatpak/io.github.WallpaperEngineLover.we_manager.yml
  86. cache-key: flatpak-builder-${{ github.sha }}
  87. upload-artifact: false
  88. - uses: actions/upload-artifact@v7
  89. with:
  90. name: we-manager-flatpak
  91. path: we-manager.flatpak
  92. if-no-files-found: error
  93. release:
  94. needs: [steamworks-vote, we-manager, flatpak]
  95. if: ${{ !cancelled() && startsWith(github.ref, 'refs/tags/v') && needs.we-manager.result == 'success' }}
  96. runs-on: ubuntu-latest
  97. permissions:
  98. contents: write
  99. steps:
  100. - uses: actions/checkout@v7
  101. - name: Check tag matches package.json version
  102. run: |
  103. version=$(node -p "require('./package.json').version")
  104. if [ "v$version" != "$GITHUB_REF_NAME" ]; then
  105. echo "tag $GITHUB_REF_NAME does not match package.json version $version"
  106. exit 1
  107. fi
  108. - uses: actions/download-artifact@v8
  109. with:
  110. path: release
  111. merge-multiple: true
  112. - name: Create release
  113. env:
  114. GH_TOKEN: ${{ github.token }}
  115. run: |
  116. gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --generate-notes \
  117. release/*.AppImage release/*.deb $(ls release/steamworks.js-*.tgz release/*.flatpak 2>/dev/null)
  118. aur:
  119. needs: release
  120. runs-on: ubuntu-latest
  121. env:
  122. HAS_AUR_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY != '' }}
  123. steps:
  124. - uses: actions/checkout@v7
  125. - name: Set the version
  126. run: sed -i -e "s/^pkgver=.*/pkgver=${GITHUB_REF_NAME#v}/" -e "s/^pkgrel=.*/pkgrel=1/"
  127. packaging/aur/we-manager-bin/PKGBUILD
  128. - name: Publish we-manager-bin to the AUR
  129. if: env.HAS_AUR_KEY == 'true'
  130. uses: KSXGitHub/github-actions-deploy-aur@v4.1.1
  131. with:
  132. pkgname: we-manager-bin
  133. pkgbuild: ./packaging/aur/we-manager-bin/PKGBUILD
  134. updpkgsums: true
  135. commit_username: ${{ secrets.AUR_USERNAME }}
  136. commit_email: ${{ secrets.AUR_EMAIL }}
  137. ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
  138. commit_message: Update to ${{ github.ref_name }}