publish.yml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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-22.04
  59. # - target: aarch64-unknown-linux-gnu
  60. # os: ubuntu-latest
  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: Install stable
  71. uses: dtolnay/rust-toolchain@master
  72. with:
  73. toolchain: "1.84.0"
  74. targets: ${{ matrix.platform.target }}
  75. - uses: Swatinem/rust-cache@v2
  76. with:
  77. cache-all-crates: "true"
  78. save-if: ${{ github.ref == 'refs/heads/main' }}
  79. - name: Free Disk Space
  80. uses: jlumbroso/free-disk-space@v1.3.1
  81. with: # speed things up a bit
  82. large-packages: false
  83. docker-images: false
  84. swap-storage: false
  85. # Todo: we want `cargo install dx` to actually just use a prebuilt binary instead of building it
  86. - name: Build and upload CLI binaries
  87. uses: taiki-e/upload-rust-binary-action@v1
  88. with:
  89. bin: dx
  90. token: ${{ secrets.GITHUB_TOKEN }}
  91. target: ${{ matrix.platform.target }}
  92. archive: $bin-$target
  93. checksum: sha256
  94. manifest_path: packages/cli/Cargo.toml
  95. ref: refs/tags/${{ env.RELEASE_POST }}
  96. features: optimizations
  97. # todo: these things
  98. # Run benchmarks, which we'll use to display on the website
  99. # release-benchmarks:
  100. # Build the vscode extension, uploading the artifact to the marketplace
  101. # release-extension:
  102. # First, run checks (clippy, tests, etc) and then publish the crates to crates.io
  103. # release-crates:
  104. # steps:
  105. # # Checkout the right branch, and the nightly stuff
  106. # - uses: actions/checkout@v4
  107. # ref: ${{ github.event.inputs.channel }}
  108. # - run: sudo apt-get update
  109. # - run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
  110. # - uses: dtolnay/rust-toolchain@nightly
  111. # with:
  112. # toolchain: nightly-2024-02-01
  113. # - uses: Swatinem/rust-cache@v2
  114. # with:
  115. # cache-all-crates: "true"
  116. # - name: Free Disk Space (Ubuntu)
  117. # uses: jlumbroso/free-disk-space@v1.3.1
  118. # with: # speed things up a bit
  119. # large-packages: false
  120. # docker-images: false
  121. # swap-storage: false
  122. # # Just make sure clippy is happy before doing anything else
  123. # # Don't publish versions with clippy errors!
  124. # - name: Clippy
  125. # run: cargo clippy --workspace --all --examples --tests --all-features --all-targets -- -D warnings
  126. # # Build the docs here too before publishing, to ensure they're up to date
  127. # - name: cargo doc
  128. # run: RUSTDOCFLAGS="--cfg docsrs" cargo doc --no-deps --workspace --all-features
  129. # - name: Publish to crates.io
  130. # run: |
  131. # git config --global user.email "github-actions[bot]@users.noreply.github.com"
  132. # git config --global user.name "github-actions[bot]"
  133. # cargo workspaces version -y ${{ env.SEMVER }} --pre-id rc --no-git-commit
  134. # # todo: actually just publish!
  135. # # cargo workspaces publish -y ${{ github.event.inputs.semver }}
  136. # this will be more useful when we publish the website with updated docs
  137. # Build the docs.rs docs and publish them to the website under the right folder
  138. # v0.4.x -> docs/0.4
  139. # v0.5.x -> docs/0.5 etc
  140. # main -> docs/nightly
  141. # strip the v from the channel, and the .x from the end, and replace main with nightly
  142. # - name: determine docs folder by channel
  143. # id: determine_docs_folder
  144. # run: echo "::set-output name=folder::$(echo ${{ github.event.inputs.channel }} | sed 's/v//g' | sed 's/\.x//g' | sed 's/main/nightly/g')"