build.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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@v5
  13. - uses: actions/setup-node@v5
  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@v4
  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@v5
  40. - uses: actions/setup-node@v5
  41. with:
  42. node-version: 22
  43. cache: npm
  44. - run: npm ci
  45. - uses: actions/download-artifact@v4
  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@v4
  56. with:
  57. name: we-manager
  58. path: |
  59. dist/*.AppImage
  60. dist/*.deb
  61. if-no-files-found: error
  62. release:
  63. needs: [steamworks-vote, we-manager]
  64. if: ${{ !cancelled() && startsWith(github.ref, 'refs/tags/v') && needs.we-manager.result == 'success' }}
  65. runs-on: ubuntu-latest
  66. permissions:
  67. contents: write
  68. steps:
  69. - uses: actions/checkout@v5
  70. - name: Check tag matches package.json version
  71. run: |
  72. version=$(node -p "require('./package.json').version")
  73. if [ "v$version" != "$GITHUB_REF_NAME" ]; then
  74. echo "tag $GITHUB_REF_NAME does not match package.json version $version"
  75. exit 1
  76. fi
  77. - uses: actions/download-artifact@v4
  78. with:
  79. path: release
  80. merge-multiple: true
  81. - name: Create release
  82. env:
  83. GH_TOKEN: ${{ github.token }}
  84. run: |
  85. gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --generate-notes \
  86. release/*.AppImage release/*.deb $(ls release/steamworks.js-*.tgz 2>/dev/null)