Skip to content

Commit df7a737

Browse files
authored
chore(ci): publish crate.io
1 parent 8c040ff commit df7a737

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/build-test.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@ jobs:
5151
export PROJECT_TITLE="${{ matrix.os }}"
5252
bash <(curl -s https://raw.githubusercontent.com/duyet/cov-rs/master/cov.sh)
5353
54+
fmt:
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@v3
59+
- uses: actions-rs/toolchain@v1
60+
with:
61+
toolchain: nightly
62+
components: rustfmt
63+
override: true
64+
- name: Run fmt check
65+
run: cargo fmt --all -- --check
66+
5467
build:
5568
runs-on: ${{ matrix.os }}
5669
strategy:
@@ -118,3 +131,39 @@ jobs:
118131
with:
119132
github_token: ${{ secrets.GITHUB_TOKEN }}
120133
publish_dir: ./target/doc
134+
135+
# automate publishing to crates.io on pushes to tags
136+
publish-crates:
137+
if: startsWith(github.ref, 'refs/tags/')
138+
runs-on: ubuntu-latest
139+
needs: [build, fmt]
140+
steps:
141+
- name: Checkout
142+
uses: actions/checkout@v3
143+
144+
- name: Rust Toolchain
145+
uses: actions-rs/toolchain@v1
146+
with:
147+
toolchain: stable
148+
149+
- name: Publish
150+
if: env.CRATES_TOKEN
151+
run: |
152+
pushd crate-attributes
153+
cargo publish --token ${{ secrets.CRATES_TOKEN }}
154+
popd
155+
# eventual consistency in crates.io dictates we wait a bit before publishing
156+
# so that crate-attributes is available for resolution
157+
sleep 20
158+
pushd crate
159+
cargo publish --token ${{ secrets.CRATES_TOKEN }}
160+
popd
161+
# eventual consistency in crates.io dictates we wait a bit before publishing
162+
# so that crate is available for resolution
163+
sleep 20
164+
pushd crate-http
165+
cargo publish --token ${{ secrets.CRATES_TOKEN }}
166+
popd
167+
env:
168+
CRATES_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
169+

0 commit comments

Comments
 (0)