juno 0.1.3-2-beta

A helper rust library for the juno microservices framework
Documentation
on:
  push:
   branches:
     - master
     - staging
     - develop

name: Continuous integration

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [windows-latest, macos-latest, ubuntu-latest]
        rust:
          - stable
          - beta
          - nightly
      fail-fast: false

    steps:
      - uses: actions/checkout@v2

      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true
          components: rustfmt, clippy

      - name: Cargo build
        uses: actions-rs/cargo@v1
        with:
          command: build
          args: --release --all
              
  release-master: # Publish release on push to master
    if: github.ref == 'refs/heads/master'
    runs-on: ubuntu-latest
    needs: build
    steps:
      - uses: actions/checkout@v2
      - run: git fetch --all --tags

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

      - name: Check Release Version
        uses: thebongy/version-check@v1
        with:
          file: Cargo.toml
          tagFormat: v${version}
        id: version_check

      - name: Publish Release (crates.io)
        uses: actions-rs/cargo@v1
        with:
          command: publish
          args: --token ${{ secrets.CRATES_IO_TOKEN }}
      
      - name: Cargo Package
        uses: actions-rs/cargo@v1
        with:
          command: package
          args: --allow-dirty
      
      - name: Publish Release (Github Release)
        uses: softprops/action-gh-release@v1
        with:
          files: target/package/juno-${{steps.version_check.outputs.rawVersion}}.crate
          tag_name: ${{steps.version_check.outputs.releaseVersion}}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  release-staging:
    if: github.ref == 'refs/heads/staging'
    runs-on: ubuntu-latest
    needs: build
    steps:
      - uses: actions/checkout@v2
      - run: git fetch --all --tags


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

      - name: Check Release Version
        uses: thebongy/version-check@v1
        with:
          file: Cargo.toml
          tagFormat: v${version}-beta
        id: version_check

      - name: Find and Replace
        run: sed -i -e 's/version = "${{ steps.version_check.outputs.rawVersion }}"/version = "${{ steps.version_check.outputs.rawVersion }}-beta"/g' Cargo.toml

      - name: Publish Release (crates.io)
        uses: actions-rs/cargo@v1
        with:
          command: publish
          args: --token ${{ secrets.CRATES_IO_TOKEN }} --allow-dirty

      - name: Cargo Package
        uses: actions-rs/cargo@v1
        with:
          command: package
          args: --allow-dirty
      
      - name: Publish Release (Github Release)
        uses: softprops/action-gh-release@v1
        with:
          files: target/package/juno-${{steps.version_check.outputs.rawVersion}}-beta.crate
          tag_name: ${{steps.version_check.outputs.releaseVersion}}
          prerelease: true
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}