width_counters 2.0.2

Atomic counters with variable bit widths and customizable atomic ordering
Documentation
name: CI
env:
  README_GENERATION_PR_TITLE: ${{ vars.README_GENERATION_PR_TITLE }}
  README_GENERATION_BRANCH: readme-generation
  CLICOLOR_FORCE: 1
on: 
  push:
    branches-ignore: [ $README_GENERATION_BRANCH ]
  pull_request:
    branches-ignore: [ $README_GENERATION_BRANCH ]
permissions:
  contents: write
  pull-requests: write

jobs: 
  ci:
    environment: deployment
    if: ${{ github.event.pull_request.title }} != vars.README_GENERATION_PR_TITLE &&  ${{ github.event.pusher.name }} != 'Github Actions[bot]'
    name: CI
    runs-on: ${{ matrix.os }}
    strategy: 
      fail-fast: false
      matrix: 
        rust: [stable, beta, nightly]
        os: [ubuntu-latest, windows-latest, macOS-latest]
    steps:
    - name: Checkout
      uses: actions/checkout@v3
    
    - name: Install rust 
      uses: actions-rs/toolchain@v1.0.6
      with:
        toolchain: ${{ matrix.rust }}
        profile: minimal
        override: true
    
    - name: Install cargo-make
      uses: actions-rs/cargo@v1.0.1
      with: 
        command: install
        args: --debug cargo-make
    
    - name: Run CI
      if: matrix.rust != 'nightly'
      uses: actions-rs/cargo@v1.0.1
      with:
        command: make
        args: ci-flow

  build-docs:
    name: Build documentation
    environment: deployment
    needs: ci
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v3

    - name: Install rust nightly
      uses: actions-rs/toolchain@v1.0.6
      with:
        toolchain: nightly
        profile: minimal
        override: true

    - name: Install cargo-make
      uses: actions-rs/cargo@v1.0.1
      with: 
        command: install
        args: --debug cargo-make

    - name: Generate readme
      uses: actions-rs/cargo@v1.0.1
      with:
        command: make
        args: generate-readme

    - name: Commit changes readme
      run: |
        git config --local user.name "Github Actions[bot]"
        git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
        git commit README.md --allow-empty -m "Automated readme generation triggered by ${{ github.ref }} at $(date --rfc-3339=seconds)"  
        
    - name: Open PR
      id: openpr
      uses: peter-evans/create-pull-request@v5
      with:
        base: 'main'
        branch: ${{ vars.README_GENERATION_BRANCH  }}
        token: ${{ secrets.PAT }}
        title: ${{ vars.README_GENERATION_PR_TITLE }}
        
    - name: Enable PR automerge
      if: steps.openpr.outputs.pull-request-operation == 'created'
      uses: peter-evans/enable-pull-request-automerge@v3
      with: 
        pull-request-number: ${{ steps.openpr.outputs.pull-request-number }}
        merge-method: squash
        token: ${{ secrets.GITHUB_TOKEN }} # use the githubtoken to avoid creating a recursive job
    
    - name: Auto approve PR
      if: steps.openpr.outcome.pull-request-operation == 'created'
      run: gh pr review --approve "${{ steps.openpr.outputs.pull-request-number }}"
      env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

    - name: Push generated readme to main
      run: | 
        git config --local user.name "Github Actions[bot]"
        git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
        git push 

  publish-crate:
    name: Publish crate to crates.io 
    needs: [ci, build-docs]
    if: ${{ github.event.pull_request.title }} == vars.README_GENERATION_PR_TITLE 
    runs-on: ubuntu-latest
    environment: deployment
    steps: 
    - name: Checkout
      uses: actions/checkout@v3
    
    - name: Toolchain 
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        override: true

    - name: Cargo publish 
      uses: katyo/publish-crates@v2
      with:
        dry-run: ${{ github.event_name != 'push' }} # only publish on push
        registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        no-verify: true
        ignore-unpublished-changes: true # prevent failing when there's no new version to publish