obelisk 0.41.2

Deterministic workflow engine
name: release-3-create-github-release

permissions:
  contents: write
  id-token: write
  attestations: write

on:
  workflow_dispatch:
    inputs:
      ref:
        description: "The ref (branch or SHA) to process"
        required: false
        type: string
        default: "latest"
      skip_latest:
        description: "skip_latest: Tag latest will be pushed to Docker Hub unless skip_latest=true"
        required: true
        type: boolean
        default: false
  workflow_call:
    inputs:
      ref:
        description: "The ref (branch or SHA) to process"
        required: false
        type: string
        default: "latest"
      skip_latest:
        description: "skip_latest: Tag latest will be pushed to Docker Hub unless skip_latest=true"
        required: true
        type: boolean
        default: false
defaults:
  run:
    shell: bash -xe {0}

jobs:
  create-github-release:
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
        with:
          ref: ${{ inputs.ref }}

      - id: git-info
        run: |
          VERSION="$(grep -m1 '^version = "' Cargo.toml | cut -d'"' -f2)"
          echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
          echo "tag=v$VERSION" >> $GITHUB_OUTPUT
          echo "version=$VERSION" >> $GITHUB_OUTPUT

      - name: Create GitHub Release
        run: |
          echo "Releasing $TAG $SHA"
          body=$(./scripts/extract-release-info.sh "$VERSION" | jq -R -s .)
          curl -v --fail -X POST \
            -H "Content-Type: application/json" \
            -H "Authorization: Bearer $GITHUB_TOKEN" \
            -d '{
              "tag_name": "'"$TAG"'",
              "target_commitish": "'"$SHA"'",
              "name": "obelisk-'"$TAG"'",
              "body": '"$body"',
              "draft": false,
              "prerelease": false
            }' \
            https://api.github.com/repos/obeli-sk/obelisk/releases

          for attempt in {1..30}; do
            if curl --fail -L \
              -H "Accept: application/vnd.github+json" \
              -H "Authorization: Bearer $GITHUB_TOKEN" \
              -H "X-GitHub-Api-Version: 2022-11-28" \
              "https://api.github.com/repos/obeli-sk/obelisk/releases/tags/$TAG"; then
              exit 0
            fi

            echo "Release tag $TAG not readable yet, retrying ($attempt/30)"
            sleep 2
          done

          echo "Timed out waiting for release tag $TAG to become readable"
          exit 1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SHA: ${{ steps.git-info.outputs.sha }}
          TAG: ${{ steps.git-info.outputs.tag }}
          VERSION: ${{ steps.git-info.outputs.version }}

  call_child:
    needs: create-github-release
    uses: ./.github/workflows/release-3.1-upload-artifacts.yml
    secrets: inherit
    with:
      ref: ${{ inputs.ref }}
      skip_latest: "${{inputs.skip_latest}}"