Skip to content

Commit 26ad972

Browse files
committed
Replace publish action with out own implementation
1 parent 7161d6f commit 26ad972

1 file changed

Lines changed: 33 additions & 5 deletions

File tree

.github/workflows/publish.yml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,46 @@ jobs:
1212
publish:
1313
if: github.repository == 'mattsse/chromiumoxide'
1414
runs-on: ubuntu-latest
15+
16+
strategy:
17+
max-parallel: 1
18+
matrix:
19+
package:
20+
- name: chromiumoxide_types
21+
path: chromiumoxide_types
22+
- name: chromiumoxide_pdl
23+
path: chromiumoxide_pdl
24+
- name: chromiumoxide_cdp
25+
path: chromiumoxide_cdp
26+
- name: chromiumoxide_fetcher
27+
path: chromiumoxide_fetcher
28+
- name: chromiumoxide
29+
path: .
1530
steps:
1631
- name: Checkout repository
1732
uses: actions/checkout@v6
1833

1934
- name: Setup Rust
2035
uses: dtolnay/rust-toolchain@stable
2136

37+
- name: Get version
38+
id: meta
39+
working-directory: ${{ matrix.package.path }}
40+
run: |
41+
PACKAGE_VERSION=$(sed -nE 's/^\s*version = "(.*?)"/\1/p' Cargo.toml)
42+
PUBLISHED_VERSION=$(cargo search ${{ matrix.package.name }} --limit 1 | sed -nE 's/^[^"]*"//; s/".*//1p' -)
43+
if [ "$PACKAGE_VERSION" != "$PUBLISHED_VERSION" ]; then
44+
echo "release=true" >> $GITHUB_OUTPUT
45+
fi
46+
2247
- name: Authenticate with crates.io
23-
uses: rust-lang/crates-io-auth-action@b7e9a28eded4986ec6b1fa40eeee8f8f165559ec # v1.0.3
2448
id: auth
49+
if: steps.meta.outputs.release == 'true'
50+
uses: rust-lang/crates-io-auth-action@b7e9a28eded4986ec6b1fa40eeee8f8f165559ec # v1.0.3
2551

26-
- name: Publish crates
27-
uses: katyo/publish-crates@5e67639f17e8a1f221e804c2bd47f7a253e45dac # v2
28-
with:
29-
registry-token: ${{ steps.auth.outputs.token }}
52+
- name: Publish ${{ matrix.package.name }}
53+
if: steps.meta.outputs.release == 'true'
54+
working-directory: ${{ matrix.package.path }}
55+
run: |
56+
cargo login ${{ steps.auth.outputs.token }}
57+
cargo publish --no-verify

0 commit comments

Comments
 (0)