diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index de2243d..ce0a45e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -84,37 +84,17 @@ jobs: run: | gh repo clone nsheaps/homebrew-devsetup homebrew-devsetup - - name: Update formula + - name: Install gomplate run: | - cd homebrew-devsetup - cat > Formula/git-wt.rb << FORMULA_EOF - # typed: false - # frozen_string_literal: true - - class GitWt < Formula - desc 'Interactive TUI for git worktree management' - homepage 'https://github.com/nsheaps/git-wt' - url 'https://github.com/nsheaps/git-wt/archive/refs/tags/${{ steps.release.outputs.tag }}.tar.gz' - sha256 '${{ steps.release.outputs.sha256 }}' - license 'MIT' - - head do - url 'https://github.com/nsheaps/git-wt.git', branch: 'main' - end - - depends_on 'gum' - - def install - bin.install 'bin/git-wt' - end - - test do - assert_match 'git-wt', shell_output("#{bin}/git-wt --help") - end - end - FORMULA_EOF - # Remove leading whitespace from heredoc - sed -i 's/^ //' Formula/git-wt.rb + curl -fsSL https://github.com/hairyhenderson/gomplate/releases/latest/download/gomplate_linux-amd64 -o /usr/local/bin/gomplate + chmod +x /usr/local/bin/gomplate + + - name: Generate formula from template + env: + Tag: ${{ steps.release.outputs.tag }} + SHA256: ${{ steps.release.outputs.sha256 }} + run: | + gomplate -f Formula/git-wt.rb.gotmpl -o homebrew-devsetup/Formula/git-wt.rb - name: Create PR to update formula with auto-merge env: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ff82d7b..48b7d03 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -21,6 +21,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup mise uses: jdx/mise-action@v2 diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..7906928 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,14 @@ +--- +AllCops: + NewCops: enable +Metrics/BlockLength: + Enabled: false +Layout/LineLength: + AllowedPatterns: + - "# renovate: .*" +Naming/FileName: + Enabled: false +Style/FrozenStringLiteralComment: + Enabled: false +Style/Documentation: + Enabled: false diff --git a/Formula/git-wt.rb.gotmpl b/Formula/git-wt.rb.gotmpl new file mode 100644 index 0000000..2bd5226 --- /dev/null +++ b/Formula/git-wt.rb.gotmpl @@ -0,0 +1,24 @@ +# typed: false +# frozen_string_literal: true + +class GitWt < Formula + desc 'Interactive TUI for git worktree management' + homepage 'https://github.com/nsheaps/git-wt' + url 'https://github.com/nsheaps/git-wt/archive/refs/tags/{{ .Env.Tag }}.tar.gz' + sha256 '{{ .Env.SHA256 }}' + license 'MIT' + + head do + url 'https://github.com/nsheaps/git-wt.git', branch: 'main' + end + + depends_on 'gum' + + def install + bin.install 'bin/git-wt' + end + + test do + assert_match 'git-wt', shell_output("#{bin}/git-wt --help") + end +end