simpleg-core 0.1.5

Core utilities for SimpleG
Documentation
name: "Continuous integration & continuous deployment"
on:
  pull_request:
    types:
      - opened
      - synchronize
      - closed
permissions:
  contents: write
jobs:
  changes:
    name: "Detect changes' types"
    runs-on: ubuntu-latest
    outputs:
      src: ${{ steps.changes.outputs.src == 'true' }}
      test: ${{ steps.changes.outputs.test == 'true' }}
    steps:
      - name: "Detect changes' type"
        id: changes
        uses: dorny/paths-filter@v3
        with:
          filters: |
            src:
              - 'src/**'
              - '.github/workflows/ci-cd.yaml'
              - 'Cargo.toml'
            test:
              - 'tests/**'
  ci-cd:
    needs: changes
    name: "Continuous integration & continuous deployment"
    runs-on: ubuntu-latest
    env:
      SECRETS_MANAGER_ACCESS_TOKEN: ${{ secrets.TEST_SECRETS_MANAGER_ACCESS_TOKEN }}
    if: needs.changes.outputs.src == 'true' || needs.changes.outputs.test == 'true'
    steps:
      - name: "Checkout code"
        uses: actions/checkout@v4
      - name: "Replace placeholder version"
        run: |
          sed -i 's/5123.0.0/${{ vars.MAJOR_VERSION }}.${{ vars.MINOR_VERSION }}.${{ github.event.number }}/g' Cargo.toml
      - name: "Cache build"
        id: cache-build
        uses: actions/cache@v4
        with:
          path: target
          key: ${{ runner.os }}-build
      - name: "Run tests"
        run: |
          cargo test --all-features
      - name: "Create release"
        if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
        uses: ncipollo/release-action@v1
        env:
          VERSION: "v${{ vars.MAJOR_VERSION }}.${{ vars.MINOR_VERSION }}.${{ github.event.number }}"
        with:
          generateReleaseNotes: true
          makeLatest: "true"
          name: ${{ env.VERSION }}
          tag: ${{ env.VERSION }}
      - name: "Upload to crates.io"
        if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
        run: |
          cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
          cargo publish --allow-dirty