publish.yml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. # Release workflow
  2. #
  3. # We parallelize builds, dump all the artifacts into a release, and then publish the release
  4. # This guarantees everything is properly built and cached in case anything goes wrong
  5. #
  6. # The artifacts also need to get pushed to the various places
  7. # - the CLI goes to the releases page for binstall
  8. # - the extension goes to the marketplace
  9. # - the docs go to the website
  10. #
  11. # We need to be aware of the channel we're releasing
  12. # - prerelease is master
  13. # - stable is whatever the latest stable release is (ie 0.4 or 0.5 or 0.6 etc)
  14. #
  15. # It's intended that this workflow is run manually, and only when we're ready to release
  16. name: Publish CLI
  17. on:
  18. workflow_dispatch:
  19. inputs:
  20. post:
  21. name: "Release Post"
  22. required: true
  23. description: Choose the release post to publish with. Must be a tag (eg v0.4.0)
  24. type: string
  25. channel:
  26. name: "CLI Binary Version"
  27. required: true
  28. description: Choose the version number to publish with. Must be a tag (ie v0.4.0)
  29. type: string
  30. env:
  31. # make sure we have the right version
  32. # main is always a prepatch until we hit 1.0, and then this script needs to be updated
  33. # note that we need to promote the prepatch to a minor bump when we actually do a release
  34. # this means the version in git will always be one minor bump ahead of the actual release - basically meaning once
  35. # we release a version, it's fair game to merge breaking changes to main since all semver-compatible changes will be
  36. # backported automatically
  37. # SEMVER: ${{ github.event.inputs.channel == 'main' && 'prerelease' || 'patch' }}
  38. # PRERELEASE_TAG: ${{ github.event.inputs.channel == 'main' && '-pre' || '' }}
  39. RELEASE_TAG: ${{ github.event.inputs.channel }}
  40. RELEASE_POST: ${{ github.event.inputs.post }}
  41. jobs:
  42. release-cli:
  43. permissions:
  44. contents: write
  45. runs-on: ${{ matrix.platform.os }}
  46. strategy:
  47. matrix:
  48. platform:
  49. - target: x86_64-pc-windows-msvc
  50. os: windows-latest
  51. - target: aarch64-pc-windows-msvc
  52. os: windows-latest
  53. - target: x86_64-apple-darwin
  54. os: macos-13
  55. - target: aarch64-apple-darwin
  56. os: macos-latest
  57. - target: x86_64-unknown-linux-gnu
  58. os: ubuntu-24.04
  59. - target: aarch64-unknown-linux-gnu
  60. os: ubuntu-24.04-arm
  61. steps:
  62. - name: Checkout
  63. uses: actions/checkout@v4
  64. - name: Install openssl on macos
  65. if: matrix.platform.os == 'macos-latest'
  66. run: brew install openssl
  67. - name: Install nasm for windows (tls)
  68. if: ${{ matrix.platform.target == 'x86_64-pc-windows-msvc' }}
  69. uses: ilammy/setup-nasm@v1
  70. - name: Free Disk Space
  71. if: ${{ matrix.platform.os == 'ubuntu-24.04' || matrix.platform.os == 'ubuntu-24.04-arm' }}
  72. uses: ./.github/actions/free-disk-space
  73. - uses: awalsh128/cache-apt-pkgs-action@latest
  74. if: ${{ matrix.platform.os == 'ubuntu-24.04' || matrix.platform.os == 'ubuntu-24.04-arm' }}
  75. with:
  76. packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev libglib2.0-dev
  77. version: 1.0
  78. - name: Install stable
  79. uses: dtolnay/rust-toolchain@master
  80. with:
  81. toolchain: "1.86.0"
  82. targets: ${{ matrix.platform.target }}
  83. - uses: Swatinem/rust-cache@v2
  84. with:
  85. cache-all-crates: "true"
  86. save-if: ${{ github.ref == 'refs/heads/main' }}
  87. - name: Free Disk Space
  88. uses: jlumbroso/free-disk-space@v1.3.1
  89. with: # speed things up a bit
  90. large-packages: false
  91. docker-images: false
  92. swap-storage: false
  93. # Todo: we want `cargo install dx` to actually just use a prebuilt binary instead of building it
  94. - name: Build and upload CLI binaries
  95. uses: taiki-e/upload-rust-binary-action@v1
  96. with:
  97. bin: dx
  98. token: ${{ secrets.GITHUB_TOKEN }}
  99. target: ${{ matrix.platform.target }}
  100. archive: $bin-$target
  101. checksum: sha256
  102. manifest_path: packages/cli/Cargo.toml
  103. ref: refs/tags/${{ env.RELEASE_POST }}
  104. zip: "all"
  105. # todo: these things
  106. # Run benchmarks, which we'll use to display on the website
  107. # release-benchmarks:
  108. # Build the vscode extension, uploading the artifact to the marketplace
  109. # release-extension:
  110. # First, run checks (clippy, tests, etc) and then publish the crates to crates.io
  111. # release-crates:
  112. # steps:
  113. # # Checkout the right branch, and the nightly stuff
  114. # - uses: actions/checkout@v4
  115. # ref: ${{ github.event.inputs.channel }}
  116. # - run: sudo apt-get update
  117. # - run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev libglib2.0-dev
  118. # - uses: dtolnay/rust-toolchain@nightly
  119. # with:
  120. # toolchain: nightly-2024-02-01
  121. # - uses: Swatinem/rust-cache@v2
  122. # with:
  123. # cache-all-crates: "true"
  124. # - name: Free Disk Space (Ubuntu)
  125. # uses: jlumbroso/free-disk-space@v1.3.1
  126. # with: # speed things up a bit
  127. # large-packages: false
  128. # docker-images: false
  129. # swap-storage: false
  130. # # Just make sure clippy is happy before doing anything else
  131. # # Don't publish versions with clippy errors!
  132. # - name: Clippy
  133. # run: cargo clippy --workspace --all --examples --tests --all-features --all-targets -- -D warnings
  134. # # Build the docs here too before publishing, to ensure they're up to date
  135. # - name: cargo doc
  136. # run: RUSTDOCFLAGS="--cfg docsrs" cargo doc --no-deps --workspace --all-features
  137. # - name: Publish to crates.io
  138. # run: |
  139. # git config --global user.email "github-actions[bot]@users.noreply.github.com"
  140. # git config --global user.name "github-actions[bot]"
  141. # cargo workspaces version -y ${{ env.SEMVER }} --pre-id rc --no-git-commit
  142. # # todo: actually just publish!
  143. # # cargo workspaces publish -y ${{ github.event.inputs.semver }}
  144. # this will be more useful when we publish the website with updated docs
  145. # Build the docs.rs docs and publish them to the website under the right folder
  146. # v0.4.x -> docs/0.4
  147. # v0.5.x -> docs/0.5 etc
  148. # main -> docs/nightly
  149. # strip the v from the channel, and the .x from the end, and replace main with nightly
  150. # - name: determine docs folder by channel
  151. # id: determine_docs_folder
  152. # run: echo "::set-output name=folder::$(echo ${{ github.event.inputs.channel }} | sed 's/v//g' | sed 's/\.x//g' | sed 's/main/nightly/g')"