amber-api 2.1.0

Rust client for Amber Electric's API
Documentation
---
name: release

permissions:
  contents: write
  packages: write

on:
  push:
    branches:
      - main
    paths:
      - Cargo.toml
      - CHANGELOG.md

env:
  FORCE_COLOR: '1'
  CLICOLOR: '1'

concurrency:
  group: release
  cancel-in-progress: false

jobs:
  # Check if this is a release merge
  check-release:
    name: Check if release merge
    runs-on: ubuntu-latest
    outputs:
      is-release: ${{ steps.check.outputs.is-release }}
      version: ${{ steps.check.outputs.version }}

    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd  # v6.0.2
        with:
          fetch-depth: 2

      - name: Check if release commit
        id: check
        run: ./scripts/ci/check-release-commit

  # Publish the release
  publish-release:
    name: Publish Release
    needs: check-release
    if: needs.check-release.outputs.is-release == 'true'
    runs-on: ubuntu-latest
    environment: crates-io
    permissions:
      id-token: write

    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd  # v6.0.2
        with:
          fetch-depth: 0
          persist-credentials: false

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Install git-cliff
        uses: taiki-e/install-action@509565405a8a987e73cf742e26b26dcc72c4b01a  # v2.67.26
        with:
          tool: git-cliff

      - name: Authenticate with crates.io
        uses: rust-lang/crates-io-auth-action@b7e9a28eded4986ec6b1fa40eeee8f8f165559ec  # v1.0.3
        id: auth

      - name: Generate GitHub App token
        id: app-token
        uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf  # v2.2.1
        with:
          app-id: ${{ secrets.RELEASE_APP_ID }}
          private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}

      - name: Configure git identity
        env:
          GH_TOKEN: ${{ steps.app-token.outputs.token }}
        run: |
          git config user.name "${{ steps.app-token.outputs.app-slug }}[bot]"
          git config user.email "$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq '.id')+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com"

      - name: Publish release
        env:
          CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
          GH_TOKEN: ${{ steps.app-token.outputs.token }}
        run: ./scripts/ci/publish-release "${{ needs.check-release.outputs.version }}"