Skip to content

Commit

Permalink
Merge pull request #211 from ramsayleung/ramsay_use_ci_to_publish_crate
Browse files Browse the repository at this point in the history
Use Github Action to automatically publish crate to crate.io
  • Loading branch information
marioortizmanero authored Sep 7, 2021
2 parents 3d6f50a + e4a9c77 commit 1e2d62b
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
create:
tags:
- v*

name: Publish Crate

jobs:
publish:
name: Deploy a new version of Rspotify to crate.io
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Release
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
shell: bash
run: |
# Publishing crates
"${GITHUB_WORKSPACE}/tools/publish.sh"
17 changes: 17 additions & 0 deletions tools/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# If crate A depends on crate B, B must come before A in this list
crates=(
rspotify-macros
rspotify-model
rspotify-http
)

for crate in "${crates[@]}"; do
echo "Publishing ${crate}"
(
cd "$crate"
cargo publish --no-verify
)
sleep 20
done

cargo publish

0 comments on commit 1e2d62b

Please sign in to comment.