tinty 0.31.0

Change the theme of your terminal, text editor and anything else with one command!
name: Release
on:
  workflow_dispatch:
    inputs:
      bump_level:
        description: "What type of release is this? (Probably 'minor')"
        required: true
        type: choice
        options:
          - minor
          - patch
env:
  CARGO_INCREMENTAL: 0
permissions:
  contents: write

jobs:
  setup-environment:
    uses: ./.github/workflows/setup-environment.yml

  lint:
    needs: setup-environment
    uses: ./.github/workflows/lint.yml
    with:
      cache-key: ${{ needs.setup-environment.outputs.cargo_cache_key }}

  test:
    needs: setup-environment
    uses: ./.github/workflows/test.yml
    with:
      cache-key: ${{ needs.setup-environment.outputs.cargo_cache_key }}

  create-release-commit:
    needs:
      - lint
      - test
    uses: ./.github/workflows/create-release-commit.yml
    with:
      bump_level: ${{ github.event.inputs.bump_level }}
    secrets:
      BOT_ACCESS_TOKEN: ${{ secrets.BOT_ACCESS_TOKEN }}

  create-release-git-tag:
    needs:
      - create-release-commit
    uses: ./.github/workflows/create-release-git-tag.yml
    with:
      ref: ${{ needs.create-release-commit.outputs.commit_sha }}
    secrets:
      RELEASE: ${{ secrets.RELEASE }}

  create-github-release:
    needs:
      - create-release-commit
      - create-release-git-tag
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: "refs/tags/${{ needs.create-release-git-tag.outputs.git_tag_name }}"

      - uses: taiki-e/create-gh-release-action@v1
        with:
          changelog: CHANGELOG.md
          token: ${{ secrets.GITHUB_TOKEN }}
          ref: "refs/tags/${{ needs.create-release-git-tag.outputs.git_tag_name }}" # This must be a git tag

  create-binaries:
    needs:
      - create-release-git-tag
      - create-github-release
    name: ${{ matrix.target }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
          - target: i686-unknown-linux-gnu
            os: ubuntu-latest
          - target: x86_64-unknown-linux-musl
            os: ubuntu-latest
          - target: i686-unknown-linux-musl
            os: ubuntu-latest
          - target: aarch64-unknown-linux-gnu
            os: ubuntu-latest
          - target: aarch64-apple-darwin
            os: macos-latest
          - target: x86_64-apple-darwin
            os: macos-latest
          - target: universal-apple-darwin
            os: macos-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: "refs/tags/${{ needs.create-release-git-tag.outputs.git_tag_name }}"
      - uses: taiki-e/upload-rust-binary-action@v1
        with:
          ref: "refs/tags/${{ needs.create-release-git-tag.outputs.git_tag_name }}"
          bin: tinty
          target: ${{ matrix.target }}
          token: ${{ secrets.GITHUB_TOKEN }}
          checksum: sha256

  publish-crate:
    needs:
      - create-release-git-tag
      - create-binaries
    uses: ./.github/workflows/publish-crate.yml
    with:
      ref: "refs/tags/${{ needs.create-release-git-tag.outputs.git_tag_name }}"
    secrets:
      CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}

  update-flake-binaries:
    needs:
      - publish-crate
    uses: ./.github/workflows/update-flake-binaries.yml
    secrets:
      BOT_ACCESS_TOKEN: ${{ secrets.BOT_ACCESS_TOKEN }}