From ee4d560af881ffface7d60e3ccaf981cb81fbeff Mon Sep 17 00:00:00 2001 From: Gwyn Date: Sun, 24 Sep 2023 19:01:46 -0600 Subject: [PATCH] Simplify everything by switching to sed --- .github/workflows/go_release.yaml | 44 +++++-------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) diff --git a/.github/workflows/go_release.yaml b/.github/workflows/go_release.yaml index 9b811ed..50af3c1 100644 --- a/.github/workflows/go_release.yaml +++ b/.github/workflows/go_release.yaml @@ -109,17 +109,15 @@ jobs: release-homebrew: runs-on: ubuntu-22.04 needs: build-and-release-tag + env: + SOURCE_CODE_URL: https://github.com/${{ github.repository }}/archive/refs/tags/${{ needs.build-and-release-tag.outputs.version_tag }}.tar.gz + steps: - name: 'Get source code artifact and binary for this version' run: | mkdir templ-downloads cd templ-downloads - curl -LO https://github.com/${{ github.repository }}/archive/refs/tags/${{ needs.build-and-release-tag.outputs.version_tag }}.tar.gz - #The binary is used to hydrate the formula later. - curl -LO https://github.com/${{ github.repository }}/releases/download/${{ needs.build-and-release-tag.outputs.version_tag }}/templ-linux - chmod +x templ-linux - ls -ltr - + curl -LO ${{ env.SOURCE_CODE_URL }} - name: 'Generate sha256 sum' id: generate-sha256 @@ -140,37 +138,9 @@ jobs: - name: 'Prepare a template file' run: | - cat > template.templ < :build - - def install - # ENV.deparallelize # if your formula fails when building in parallel - system "go", "build", *std_go_args(ldflags: "-s -w") - end - - test do - # `test do` will create, run in and delete a temporary directory. - # - # This test will fail and we won't accept that! For Homebrew/homebrew-core - # this will need to be a test that verifies the functionality of the - # software. Run the test with `brew test templ`. Options passed - # to `brew install` such as `--HEAD` also need to be provided to `brew test`. - # - # The installed folder is not in the path, so use the entire path to any - # executables being tested: `system "#{bin}/program", "do", "something"`. - system "false" - end - EOF - - chmod +x ./templ-downloads/templ - cat template.templ | ./templ-downloads/templ TAG=${{ needs.build-and-release-tag.outputs.version_tag }} SHASUM=${{ steps.generate-sha256.outputs.sha256 }} > Formula/templ.rb + sed -i 's/sha256.*/sha256: "${{ steps.generate-sha256.outputs.sha256 }}"/' Formula/templ.rb + sed -i 's/url*/url: "${{ env.SOURCE_CODE_URL }}"/' Formula/templ.rb + - name: "Add new repo file" run: |