Skip to content

Commit

Permalink
chore(ci): publish crate.io
Browse files Browse the repository at this point in the history
  • Loading branch information
duyet authored Mar 5, 2023
1 parent 8c040ff commit df7a737
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ jobs:
export PROJECT_TITLE="${{ matrix.os }}"
bash <(curl -s https://raw.githubusercontent.com/duyet/cov-rs/master/cov.sh)
fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: rustfmt
override: true
- name: Run fmt check
run: cargo fmt --all -- --check

build:
runs-on: ${{ matrix.os }}
strategy:
Expand Down Expand Up @@ -118,3 +131,39 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc

# automate publishing to crates.io on pushes to tags
publish-crates:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [build, fmt]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Rust Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Publish
if: env.CRATES_TOKEN
run: |
pushd crate-attributes
cargo publish --token ${{ secrets.CRATES_TOKEN }}
popd
# eventual consistency in crates.io dictates we wait a bit before publishing
# so that crate-attributes is available for resolution
sleep 20
pushd crate
cargo publish --token ${{ secrets.CRATES_TOKEN }}
popd
# eventual consistency in crates.io dictates we wait a bit before publishing
# so that crate is available for resolution
sleep 20
pushd crate-http
cargo publish --token ${{ secrets.CRATES_TOKEN }}
popd
env:
CRATES_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}

0 comments on commit df7a737

Please sign in to comment.