Skip to content

Commit ad180e3

Browse files
committed
Merge pull request 'ci: verify OP_SERVICE_ACCOUNT_TOKEN before crates.io publish' (#7) from fix/verify-1password-secret into main
2 parents dd8bd5c + e194bda commit ad180e3

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎.github/workflows/publish-crates.yml‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ jobs:
2626
- uses: dtolnay/rust-toolchain@stable
2727
- uses: Swatinem/rust-cache@v2
2828
- uses: 1password/install-cli-action@v2
29+
- name: Verify 1Password service account secret
30+
env:
31+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
32+
run: |
33+
if [ -z "$OP_SERVICE_ACCOUNT_TOKEN" ]; then
34+
echo "ERROR: OP_SERVICE_ACCOUNT_TOKEN secret is not configured." >&2
35+
echo "Set it as a repository or organisation secret to enable crates.io publishing." >&2
36+
exit 1
37+
fi
2938
- name: Get crates.io token from 1Password
3039
id: token
3140
env:
@@ -46,7 +55,7 @@ jobs:
4655
echo "Missing manifest for $crate at $manifest" >&2
4756
exit 1
4857
fi
49-
version=$(grep -m1 '^version' "$manifest" | sed 's/.*"\(.*\)".*//')
58+
version=$(grep -m1 '^version' "$manifest" | sed 's/.*"\(.*\)".*/\1/')
5059
if curl -fsS "https://crates.io/api/v1/crates/$crate/$version" >/dev/null 2>&1; then
5160
echo "$crate $version already exists on crates.io; skipping"
5261
continue

0 commit comments

Comments
 (0)