imagekit 0.1.0-beta+1

Rust API Client for ImageKit.io a file storage and image processing service
Documentation
name: release

on:
  push:
    tags:
      - 'v*'

jobs:
  test:
    name: Runs tests
    runs-on: ubuntu-latest
    env:
      IMAGEKIT_PUBLIC_KEY: ${{ secrets.IMAGEKIT_PUBLIC_KEY }}
      IMAGEKIT_PRIVATE_KEY: ${{ secrets.IMAGEKIT_PRIVATE_KEY }}
      IMAGEKIT_URL_ENDPOINT: ${{ secrets.IMAGEKIT_URL_ENDPOINT }}
    steps:
      - uses: actions/checkout@v1

      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable

      - name: run cargo test
        run: cargo test

  publish-dry-run:
    name: "Runs cargo publish --dry-run"
    needs: test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1

      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable

      - name: publish crate
        run: cargo publish --dry-run

  create-release:
    name: Create Release
    needs: publish-dry-run
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Create Release with Notes
        uses: actions/github-script@v5
        with:
          github-token: ${{secrets.GITHUB_TOKEN}}
          script: |
            await github.request(`POST /repos/${{ github.repository }}/releases`, {
              tag_name: "${{ github.ref }}",
              generate_release_notes: true
            });

  publish-crate:
    name: Publish to crates.io
    needs: create-release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1

      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
      - run: cargo login ${CRATES_IO_TOKEN}
        env:
          CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}

      - name: publish crate
        run: cargo publish