Skip to content

Commit e0d10b1

Browse files
Shahinyanmclaude
andcommitted
fix(ci): move CARGO_REGISTRY_TOKEN to job-level env for cargo publish
The token was only set as a step-level env for cargo login, making it invisible to subsequent cargo publish steps. Cargo reads CARGO_REGISTRY_TOKEN automatically -- no login step needed. Added token presence check for clearer CI diagnostics. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 7aa0858 commit e0d10b1

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

.github/workflows/publish.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ jobs:
1010
publish:
1111
name: cargo publish
1212
runs-on: ubuntu-latest
13+
env:
14+
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
1315
steps:
1416
- uses: actions/checkout@v4
1517

@@ -19,10 +21,13 @@ jobs:
1921
- name: Cache cargo
2022
uses: Swatinem/rust-cache@v2
2123

22-
- name: cargo login
23-
env:
24-
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
25-
run: cargo login "$CARGO_REGISTRY_TOKEN"
24+
- name: Verify token is set
25+
run: |
26+
if [ -z "$CARGO_REGISTRY_TOKEN" ]; then
27+
echo "::error::CARGO_REGISTRY_TOKEN is empty. Check CRATES_IO_TOKEN secret."
28+
exit 1
29+
fi
30+
echo "Token is set (length: ${#CARGO_REGISTRY_TOKEN})"
2631
2732
- name: Publish task-journal-core
2833
run: cargo publish -p task-journal-core

0 commit comments

Comments
 (0)