release.yml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. name: Release
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. release_channel:
  6. description: 'Release channel'
  7. required: false
  8. default: 'next'
  9. type: string
  10. permissions:
  11. contents: read
  12. env:
  13. APP_NAME: tailwindcss-oxide
  14. NODE_VERSION: 20
  15. OXIDE_LOCATION: ./crates/node
  16. jobs:
  17. build:
  18. strategy:
  19. matrix:
  20. include:
  21. # Windows
  22. - os: windows-latest
  23. target: x86_64-pc-windows-msvc
  24. # macOS
  25. - os: macos-latest
  26. target: x86_64-apple-darwin
  27. strip: strip -x # Must use -x on macOS. This produces larger results on linux.
  28. - os: macos-latest
  29. target: aarch64-apple-darwin
  30. page-size: 14
  31. strip: strip -x # Must use -x on macOS. This produces larger results on linux.
  32. # Android
  33. - os: ubuntu-latest
  34. target: aarch64-linux-android
  35. strip: ${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip
  36. - os: ubuntu-latest
  37. target: armv7-linux-androideabi
  38. strip: ${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip
  39. # Linux
  40. - os: ubuntu-latest
  41. target: x86_64-unknown-linux-gnu
  42. strip: strip
  43. container:
  44. image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
  45. - os: ubuntu-latest
  46. target: aarch64-unknown-linux-gnu
  47. strip: llvm-strip
  48. container:
  49. image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
  50. - os: ubuntu-latest
  51. target: armv7-unknown-linux-gnueabihf
  52. strip: llvm-strip
  53. container:
  54. image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-zig
  55. - os: ubuntu-latest
  56. target: aarch64-unknown-linux-musl
  57. strip: aarch64-linux-musl-strip
  58. download: true
  59. container:
  60. image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
  61. - os: ubuntu-latest
  62. target: x86_64-unknown-linux-musl
  63. strip: strip
  64. download: true
  65. container:
  66. image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
  67. name: Build ${{ matrix.target }} (OXIDE)
  68. runs-on: ${{ matrix.os }}
  69. container: ${{ matrix.container }}
  70. timeout-minutes: 15
  71. steps:
  72. - uses: actions/checkout@v4
  73. - uses: pnpm/action-setup@v4
  74. - name: Use Node.js ${{ env.NODE_VERSION }}
  75. uses: actions/setup-node@v4
  76. with:
  77. node-version: ${{ env.NODE_VERSION }}
  78. cache: 'pnpm'
  79. # Cargo already skips downloading dependencies if they already exist
  80. - name: Cache cargo
  81. uses: actions/cache@v4
  82. with:
  83. path: |
  84. ~/.cargo/bin/
  85. ~/.cargo/registry/index/
  86. ~/.cargo/registry/cache/
  87. ~/.cargo/git/db/
  88. target/
  89. key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
  90. # Cache the `oxide` Rust build
  91. - name: Cache oxide build
  92. uses: actions/cache@v4
  93. with:
  94. path: |
  95. ./oxide/target/
  96. ./crates/node/*.node
  97. ./crates/node/index.js
  98. ./crates/node/index.d.ts
  99. key: ${{ runner.os }}-${{ matrix.target }}-oxide-${{ hashFiles('./crates/**/*') }}
  100. - name: Install Node.JS
  101. uses: actions/setup-node@v4
  102. with:
  103. node-version: ${{ env.NODE_VERSION }}
  104. - name: Install Rust (Stable)
  105. if: ${{ matrix.download }}
  106. run: |
  107. rustup default stable
  108. - name: Setup rust target
  109. run: rustup target add ${{ matrix.target }}
  110. - name: Install dependencies
  111. run: pnpm install --ignore-scripts --filter=!./playgrounds/*
  112. - name: Build release
  113. run: pnpm run --filter ${{ env.OXIDE_LOCATION }} build
  114. env:
  115. RUST_TARGET: ${{ matrix.target }}
  116. JEMALLOC_SYS_WITH_LG_PAGE: ${{ matrix.page-size }}
  117. - name: Strip debug symbols # https://github.com/rust-lang/rust/issues/46034
  118. if: ${{ matrix.strip }}
  119. run: ${{ matrix.strip }} ${{ env.OXIDE_LOCATION }}/*.node
  120. - name: Upload artifacts
  121. uses: actions/upload-artifact@v4
  122. with:
  123. name: bindings-${{ matrix.target }}
  124. path: ${{ env.OXIDE_LOCATION }}/*.node
  125. release:
  126. runs-on: macos-14
  127. timeout-minutes: 15
  128. name: Build and release Tailwind CSS
  129. permissions:
  130. contents: write # for softprops/action-gh-release to create GitHub release
  131. # https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions
  132. id-token: write
  133. needs:
  134. - build
  135. steps:
  136. - uses: actions/checkout@v4
  137. with:
  138. fetch-tags: true
  139. fetch-depth: 20
  140. - run: git fetch --tags -f
  141. - name: Resolve version
  142. id: vars
  143. run: |
  144. echo "TAG_NAME=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
  145. - uses: pnpm/action-setup@v4
  146. - name: Use Node.js ${{ env.NODE_VERSION }}
  147. uses: actions/setup-node@v4
  148. with:
  149. node-version: ${{ env.NODE_VERSION }}
  150. cache: 'pnpm'
  151. registry-url: 'https://registry.npmjs.org'
  152. # Cargo already skips downloading dependencies if they already exist
  153. - name: Cache cargo
  154. uses: actions/cache@v4
  155. with:
  156. path: |
  157. ~/.cargo/bin/
  158. ~/.cargo/registry/index/
  159. ~/.cargo/registry/cache/
  160. ~/.cargo/git/db/
  161. target/
  162. key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
  163. # Cache the `oxide` Rust build
  164. - name: Cache oxide build
  165. uses: actions/cache@v4
  166. with:
  167. path: |
  168. ./oxide/target/
  169. ./crates/node/*.node
  170. ./crates/node/index.js
  171. ./crates/node/index.d.ts
  172. key: ${{ runner.os }}-${{ matrix.target }}-oxide-${{ hashFiles('./crates/**/*') }}
  173. - name: Install dependencies
  174. run: pnpm --filter=!./playgrounds/* install
  175. - name: Download artifacts
  176. uses: actions/download-artifact@v4
  177. with:
  178. path: ${{ env.OXIDE_LOCATION }}
  179. - name: Move artifacts
  180. run: |
  181. cd ${{ env.OXIDE_LOCATION }}
  182. cp bindings-x86_64-pc-windows-msvc/* ./npm/win32-x64-msvc/
  183. cp bindings-x86_64-apple-darwin/* ./npm/darwin-x64/
  184. cp bindings-aarch64-apple-darwin/* ./npm/darwin-arm64/
  185. cp bindings-aarch64-linux-android/* ./npm/android-arm64/
  186. cp bindings-armv7-linux-androideabi/* ./npm/android-arm-eabi/
  187. cp bindings-aarch64-unknown-linux-gnu/* ./npm/linux-arm64-gnu/
  188. cp bindings-aarch64-unknown-linux-musl/* ./npm/linux-arm64-musl/
  189. cp bindings-armv7-unknown-linux-gnueabihf/* ./npm/linux-arm-gnueabihf/
  190. cp bindings-x86_64-unknown-linux-gnu/* ./npm/linux-x64-gnu/
  191. cp bindings-x86_64-unknown-linux-musl/* ./npm/linux-x64-musl/
  192. - name: Build Tailwind CSS
  193. run: pnpm run build
  194. - name: Run pre-publish optimizations scripts
  195. run: node ./scripts/pre-publish-optimizations.mjs
  196. - name: Lock pre-release versions
  197. run: node ./scripts/lock-pre-release-versions.mjs
  198. - name: Get release notes
  199. run: |
  200. RELEASE_NOTES=$(node ./scripts/release-notes.mjs)
  201. echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
  202. echo "$RELEASE_NOTES" >> $GITHUB_ENV
  203. echo "EOF" >> $GITHUB_ENV
  204. - name: Upload Standalone Artifacts
  205. uses: actions/upload-artifact@v4
  206. with:
  207. name: tailwindcss-standalone
  208. path: packages/@tailwindcss-standalone/dist/
  209. - name: Publish
  210. run: pnpm --recursive publish --tag ${{ inputs.release_channel }} --no-git-checks
  211. env:
  212. NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
  213. - name: Release
  214. uses: softprops/action-gh-release@v2
  215. with:
  216. draft: true
  217. tag_name: ${{ env.TAG_NAME }}
  218. body: |
  219. ${{ env.RELEASE_NOTES }}
  220. files: |
  221. packages/@tailwindcss-standalone/dist/sha256sums.txt
  222. packages/@tailwindcss-standalone/dist/tailwindcss-linux-arm64
  223. packages/@tailwindcss-standalone/dist/tailwindcss-linux-x64
  224. packages/@tailwindcss-standalone/dist/tailwindcss-macos-arm64
  225. packages/@tailwindcss-standalone/dist/tailwindcss-macos-x64
  226. packages/@tailwindcss-standalone/dist/tailwindcss-windows-x64.exe