Skip to content

Commit 9c3d925

Browse files
cursoragentlovasoa
andcommitted
Refactor publish workflow and remove dry-run script
Co-authored-by: contact <[email protected]>
1 parent ecb02eb commit 9c3d925

File tree

2 files changed

+10
-77
lines changed

2 files changed

+10
-77
lines changed

.github/workflows/publish.yml

Lines changed: 10 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,36 @@
11
name: Publish workspace crates
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
dry_run:
7-
description: "Run cargo publish with --dry-run"
8-
required: false
9-
default: "false"
10-
type: choice
11-
options: ["false", "true"]
124
push:
135
branches:
14-
- main
15-
paths:
16-
- '.github/workflows/publish.yml'
17-
- '**/Cargo.toml'
6+
- '**'
7+
tags:
8+
- '*'
189
pull_request:
19-
paths:
20-
- '.github/workflows/publish.yml'
21-
- '**/Cargo.toml'
22-
23-
permissions:
24-
contents: read
25-
26-
concurrency:
27-
group: publish-${{ github.ref }}
28-
cancel-in-progress: false
10+
branches:
11+
- '**'
2912

3013
jobs:
3114
publish:
32-
name: Cargo publish (workspace)
3315
runs-on: ubuntu-latest
34-
if: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run == 'false' }}
3516
steps:
3617
- name: Checkout
3718
uses: actions/checkout@v4
3819

39-
- name: Install system dependencies
40-
run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev | cat
41-
4220
- name: Use latest stable Rust (dtolnay/rust-toolchain)
4321
uses: dtolnay/rust-toolchain@stable
4422
with:
4523
toolchain: stable
46-
components: ''
4724

48-
- name: Verify cargo version
49-
run: cargo --version | tee /tmp/cargo-version.txt
50-
51-
- name: Configure crates.io token
52-
if: ${{ inputs.dry_run != 'true' && github.event_name != 'pull_request' }}
53-
env:
54-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
55-
run: |
56-
test -n "$CARGO_REGISTRY_TOKEN" || { echo "CARGO_REGISTRY_TOKEN is not set"; exit 1; }
25+
- name: Dry run workspace publish
26+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
27+
run: cargo publish --workspace --dry-run --no-verify
5728

5829
- name: Publish workspace
30+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
5931
env:
6032
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
61-
run: |
62-
set -euo pipefail
63-
echo "Running cargo publish --workspace"
64-
cargo publish --workspace
65-
66-
dry-run:
67-
name: Cargo publish dry-run (CI)
68-
runs-on: ubuntu-latest
69-
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.dry_run == 'true') }}
70-
steps:
71-
- name: Checkout
72-
uses: actions/checkout@v4
73-
74-
- name: Install system dependencies
75-
run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev | cat
76-
77-
- name: Use latest stable Rust (dtolnay/rust-toolchain)
78-
uses: dtolnay/rust-toolchain@stable
79-
with:
80-
toolchain: stable
81-
82-
- name: Dry run publish (workspace)
83-
run: cargo publish --workspace --allow-dirty --dry-run --no-verify
33+
run: cargo publish --workspace
8434
on:
8535
workflow_dispatch: {}
8636
push:

scripts/publish-dry-run.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)