about summary refs log tree commit diff
path: root/src/tools/rust-analyzer/.github/workflows/publish-libs.yaml
blob: f2c8b6365b669265f440761183bbe27905696d1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: publish-libs
on:
  workflow_dispatch:
  push:
    branches:
      - master
    paths:
      - "lib/**"

jobs:
  publish-libs:
    if: ${{ github.repository == 'rust-lang/rust-analyzer' || github.event_name == 'workflow_dispatch' }}
    name: publish
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Install Rust toolchain
        run: rustup update --no-self-update stable

      - name: Install cargo-workspaces
        run: cargo install cargo-workspaces --version "0.3.6"

      - name: Publish Crates
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        shell: bash
        run: |
          git config --global user.email "runner@gha.local"
          git config --global user.name "GitHub Action"
          # Only publish the crates under lib/
          sed -i 's|^members = .*$|members = ["lib/*"]|' Cargo.toml
          cargo workspaces publish --yes --exact --from-git --no-git-commit --allow-dirty