nixpacks 0.2.13

Generate an OCI compliant image based off app source
Documentation
name: Bump nixpacks-flake version

on:
  push:
    tags:
      - "v*.*.*"

env:
  REGEX: v[0-9]+\.[0-9]+\.[0-9]+
  FLAKE: flake.nix
  BRANCH_NAME: auto-update/nixpacks-flake
  GIT_AUTHOR_NAME: ${{ github.repository_owner }}
  GIT_AUTHOR_EMAIL: ${{ github.repository_owner }}@users.noreply.github.com

jobs:
  bump-version:
    runs-on: ubuntu-latest
    defaults:
      run:
        shell: bash

    steps:
      - name: Get the release version from the tag and old version
        shell: bash
        if: env.NIXPACKS_VERSION == ''
        run: |
          echo "NIXPACKS_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
          echo "version is: ${{ NIXPACKS_VERSION }}"

      - uses: actions/checkout@v3
        with:
          ref: main
          fetch-depth: 1

      - name: Get old version
        run: |
          export version=$(grep -owE ${{ env.REGEX }} ${{ env.FLAKE }})
          echo "OLD_VERSION=$version" >> $GITHUB_ENV

      - name: Update version in flake.nix
        run: sed -i "s/$OLD_VERSION/$NIXPACKS_VERSION/g" ${{ env.FLAKE }}

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v4
        with:
          commit-message: "update: flake package version"
          author: ${{ env.GIT_AUTHOR_NAME }} <${{ env.GIT_AUTHOR_EMAIL }}>
          title: 'nixpacks-flake: ${{ env.OLD_VERSION }} -> ${{ env.NIXPACKS_VERSION }}'
          branch: ${{ env.BRANCH_NAME }}
          signoff: true
          delete-branch: true