diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 00000000..b9866c92 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -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" diff --git a/tools/publish.sh b/tools/publish.sh new file mode 100755 index 00000000..77e45955 --- /dev/null +++ b/tools/publish.sh @@ -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