publish.yml 5.7 KB

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