name: Tag and Release

on:
  workflow_dispatch:
  push:
    branches:
      - main
    paths:
      - "lib/html_proofer/version.rb"
  pull_request_target:
    types:
      - closed

permissions:
  pull-requests: write
  contents: write
  id-token: write
  actions: write

jobs:
  ruby:
    uses: gjtorikian/actions/.github/workflows/ruby_gem_release.yml@main
    secrets:
      gh_token: ${{ secrets.GITHUB_TOKEN }}
    with:
      gem_name: html-proofer
      version_filepath: lib/html_proofer/version.rb
      prepare: ${{ github.event_name == 'push' }}
      release: ${{ github.event_name == 'workflow_dispatch' || ((github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'release'))) }}
      oidc_role_to_assume: rg_oidc_akr_vy3by4gqb69w9cztrhf9
