publish.yml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. channel:
  21. name: "Branch to publish"
  22. required: true
  23. description: Choose the version number to publish with
  24. type: string
  25. env:
  26. # make sure we have the right version
  27. # main is always a prepatch until we hit 1.0, and then this script needs to be updated
  28. # note that we need to promote the prepatch to a minor bump when we actually do a release
  29. # this means the version in git will always be one minor bump ahead of the actual release - basically meaning once
  30. # we release a version, it's fair game to merge breaking changes to main since all semver-compatible changes will be
  31. # backported automatically
  32. SEMVER: ${{ github.event.inputs.channel == 'main' && 'prerelease' || 'patch' }}
  33. PRERELEASE_TAG: ${{ github.event.inputs.channel == 'main' && '-pre' || '' }}
  34. RELEASE_TAG: ${{ github.event.inputs.channel }}
  35. jobs:
  36. release-cli:
  37. permissions:
  38. contents: write
  39. runs-on: ${{ matrix.platform.os }}
  40. strategy:
  41. matrix:
  42. include:
  43. - target: x86_64-pc-windows-msvc
  44. os: windows-latest
  45. - target: aaarch64-pc-windows-msvc
  46. os: windows-latest
  47. - target: x86_64-apple-darwin
  48. os: macos-latest
  49. - target: aarch64-apple-darwin
  50. os: macos-latest
  51. - target: x86_64-unknown-linux-gnu
  52. os: ubuntu-latest
  53. - target: aarch64-unknown-linux-gnu
  54. os: ubuntu-latest
  55. steps:
  56. - name: Checkout
  57. uses: actions/checkout@v4
  58. - name: Install stable
  59. uses: dtolnay/rust-toolchain@master
  60. with:
  61. toolchain: "1.75.0"
  62. targets: ${{ matrix.platform.target }}
  63. - uses: Swatinem/rust-cache@v2
  64. with:
  65. cache-all-crates: "true"
  66. save-if: ${{ github.ref == 'refs/heads/main' }}
  67. - name: Free Disk Space
  68. uses: jlumbroso/free-disk-space@v1.3.1
  69. with: # speed things up a bit
  70. large-packages: false
  71. docker-images: false
  72. swap-storage: false
  73. # Todo: we want `cargo install dx` to actually just use a prebuilt binary instead of building it
  74. - name: Build and upload CLI binaries
  75. uses: taiki-e/upload-rust-binary-action@v1
  76. with:
  77. bin: dx
  78. token: ${{ secrets.GITHUB_TOKEN }}
  79. target: ${{ matrix.platform.target }}
  80. archive: dx-${{ matrix.platform.target }}${{ env.PRERELEASE_TAG }}
  81. checksum: sha256
  82. manifest_path: packages/cli/Cargo.toml
  83. # todo: these things
  84. # Run benchmarks, which we'll use to display on the website
  85. # release-benchmarks:
  86. # Build the vscode extension, uploading the artifact to the marketplace
  87. # release-extension:
  88. # First, run checks (clippy, tests, etc) and then publish the crates to crates.io
  89. # release-crates:
  90. # steps:
  91. # # Checkout the right branch, and the nightly stuff
  92. # - uses: actions/checkout@v4
  93. # ref: ${{ github.event.inputs.channel }}
  94. # - run: sudo apt-get update
  95. # - run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
  96. # - uses: dtolnay/rust-toolchain@nightly
  97. # with:
  98. # toolchain: nightly-2024-02-01
  99. # - uses: Swatinem/rust-cache@v2
  100. # with:
  101. # cache-all-crates: "true"
  102. # - name: Free Disk Space (Ubuntu)
  103. # uses: jlumbroso/free-disk-space@v1.3.1
  104. # with: # speed things up a bit
  105. # large-packages: false
  106. # docker-images: false
  107. # swap-storage: false
  108. # # Just make sure clippy is happy before doing anything else
  109. # # Don't publish versions with clippy errors!
  110. # - name: Clippy
  111. # run: cargo clippy --workspace --all --examples --tests --all-features --all-targets -- -D warnings
  112. # # Build the docs here too before publishing, to ensure they're up to date
  113. # - name: cargo doc
  114. # run: RUSTDOCFLAGS="--cfg docsrs" cargo doc --no-deps --workspace --all-features
  115. # - name: Publish to crates.io
  116. # run: |
  117. # git config --global user.email "github-actions[bot]@users.noreply.github.com"
  118. # git config --global user.name "github-actions[bot]"
  119. # cargo workspaces version -y ${{ env.SEMVER }} --pre-id rc --no-git-commit
  120. # # todo: actually just publish!
  121. # # cargo workspaces publish -y ${{ github.event.inputs.semver }}
  122. # this will be more useful when we publish the website with updated docs
  123. # Build the docs.rs docs and publish them to the website under the right folder
  124. # v0.4.x -> docs/0.4
  125. # v0.5.x -> docs/0.5 etc
  126. # main -> docs/nightly
  127. # strip the v from the channel, and the .x from the end, and replace main with nightly
  128. # - name: determine docs folder by channel
  129. # id: determine_docs_folder
  130. # run: echo "::set-output name=folder::$(echo ${{ github.event.inputs.channel }} | sed 's/v//g' | sed 's/\.x//g' | sed 's/main/nightly/g')"