about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonas Schievink <jonas.schievink@ferrous-systems.com>2023-01-25 15:02:52 +0100
committerJonas Schievink <jonas.schievink@ferrous-systems.com>2023-01-25 15:02:52 +0100
commit7cb0cfa3aa08546e78aeff5d5f447d63d81c5378 (patch)
treea1e4ef58ea15bd256b83592eb56641a49443b028
parent85736de3bcd5ecab337a022bcc43014917296388 (diff)
downloadrust-7cb0cfa3aa08546e78aeff5d5f447d63d81c5378.tar.gz
rust-7cb0cfa3aa08546e78aeff5d5f447d63d81c5378.zip
Try to fix auto-publishing of lib crates
-rw-r--r--.github/workflows/autopublish.yaml (renamed from .github/workflows/publish.yml)4
-rw-r--r--.github/workflows/publish-libs.yaml35
2 files changed, 37 insertions, 2 deletions
diff --git a/.github/workflows/publish.yml b/.github/workflows/autopublish.yaml
index 73e62ab32c6..279f86b458d 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/autopublish.yaml
@@ -1,4 +1,4 @@
-name: publish
+name: autopublish
 on:
   workflow_dispatch: # We can add version input when 1.0 is released and scheduled releases are removed
 
@@ -25,7 +25,7 @@ jobs:
       - name: Install cargo-workspaces
         run: cargo install cargo-workspaces
 
-      - name: Release
+      - name: Publish Crates
         env:
           CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
           PATCH: ${{ github.run_number }}
diff --git a/.github/workflows/publish-libs.yaml b/.github/workflows/publish-libs.yaml
new file mode 100644
index 00000000000..1b843fff1a4
--- /dev/null
+++ b/.github/workflows/publish-libs.yaml
@@ -0,0 +1,35 @@
+name: publish-libs
+on:
+  workflow_dispatch:
+  push:
+    branches:
+      - main
+    paths:
+      - 'lib/**'
+
+jobs:
+  publish-libs:
+    name: publish
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v3
+        with:
+          fetch-depth: 0
+
+      - name: Install Rust toolchain
+        run: rustup update --no-self-update stable
+
+      - name: Install cargo-workspaces
+        run: cargo install cargo-workspaces
+
+      - 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"
+          # Remove r-a crates from the workspaces so we don't auto-publish them as well
+          sed -i 's/ "crates\/\*"//' ./Cargo.toml
+          cargo workspaces publish --yes --exact --from-git --no-git-commit --allow-dirty