1name: autopublish 2on: 3 workflow_dispatch: # We can add version input when 1.0 is released and scheduled releases are removed 4 5 # schedule: 6 # - cron: "0 0 * * *" # midnight UTC 7 8 push: 9 branches: 10 - release 11 12jobs: 13 publish: 14 name: publish 15 runs-on: ubuntu-latest 16 steps: 17 - name: Checkout repository 18 uses: actions/checkout@v3 19 with: 20 fetch-depth: 0 21 22 - name: Install Rust toolchain 23 run: rustup update --no-self-update stable 24 25 - name: Install cargo-workspaces 26 run: cargo install cargo-workspaces 27 28 - name: Publish Crates 29 env: 30 CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} 31 RUN_NUMBER: ${{ github.run_number }} 32 shell: bash 33 run: | 34 git config --global user.email "runner@gha.local" 35 git config --global user.name "GitHub Action" 36 rm Cargo.lock 37 # Fix names for crates that were published before switch to kebab-case. 38 cargo workspaces rename --from base-db base_db 39 cargo workspaces rename --from hir-def hir_def 40 cargo workspaces rename --from hir-expand hir_expand 41 cargo workspaces rename --from hir-ty hir_ty 42 cargo workspaces rename --from ide-assists ide_assists 43 cargo workspaces rename --from ide-completion ide_completion 44 cargo workspaces rename --from ide-db ide_db 45 cargo workspaces rename --from ide-diagnostics ide_diagnostics 46 cargo workspaces rename --from ide-ssr ide_ssr 47 cargo workspaces rename --from proc-macro-api proc_macro_api 48 cargo workspaces rename --from proc-macro-srv proc_macro_srv 49 cargo workspaces rename --from project-model project_model 50 cargo workspaces rename --from test-utils test_utils 51 cargo workspaces rename --from text-edit text_edit 52 cargo workspaces rename ra_ap_%n 53 # Remove library crates from the workspaces so we don't auto-publish them as well 54 sed -i 's/ "lib\/\*",//' ./Cargo.toml 55 find crates/rust-analyzer -type f -name '*.rs' -exec sed -i 's/rust_analyzer/ra_ap_rust_analyzer/g' {} + 56 cargo workspaces publish --yes --force '*' --exact --no-git-commit --allow-dirty --skip-published custom 0.0.$(($RUN_NUMBER + 133)) 57