From e961712c86c05eba02497f89cfff632066531393 Mon Sep 17 00:00:00 2001 From: angelahuqing Date: Fri, 1 Nov 2024 13:32:26 -0700 Subject: [PATCH 1/2] [SERV-1172] Add goreleaser and associated files --- .github/workflows/release.yml | 130 ++++++---------------------------- .gitignore | 2 + .goreleaser.yaml | 39 ++++++++++ 3 files changed, 64 insertions(+), 107 deletions(-) create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a3459a8..a8a352b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,115 +1,31 @@ -name: Build and Release Process - -# Defines environmental variables -env: - GO_VERSION: '1.22.2' +name: Release Festerize on: release: types: [ published ] +permissions: + contents: write + jobs: - build_and_upload_ubuntu: + goreleaser: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - # Setup Go - - name: Setup Go - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 - with: - go-version: "${{ env.GO_VERSION }}" - - - name: Build and Run - run: | - go build -o festerize main.go - - # Zip binary for Ubuntu - - name: Zip binary - run: zip festerize_ubuntu.zip festerize - - - name: Upload Ubunutu Release Assets - uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - files: festerize_ubuntu.zip - - build_and_upload_mac: - runs-on: macos-latest - - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - # Setup Go - - name: Setup Go - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 - with: - go-version: "${{ env.GO_VERSION }}" - - - name: Build and Run - run: | - go build -o festerize main.go - - # Zip binary for Mac - - name: Zip binary - run: zip festerize_mac.zip festerize - - name: Upload Mac Release Assets - uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - files: festerize_mac.zip - - build_and_upload_mac_intel: - runs-on: macos-12 - - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - # Setup Go - - name: Setup Go - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 - with: - go-version: "${{ env.GO_VERSION }}" - - - name: Build and Run - run: | - go build -o festerize main.go - - # Zip binary for Mac - - name: Zip binary - run: zip festerize_mac_intel.zip festerize - - name: Upload Mac Release Assets - uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - files: festerize_mac_intel.zip - - build_and_upload_windows: - runs-on: windows-latest - - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - # Setup Go - - name: Setup Go - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 - with: - go-version: "${{ env.GO_VERSION }}" - - - name: Build and Run - run: | - go build -o festerize main.go - - # Zip binary for Windoes - - name: Zip binary - run: Compress-Archive -Path festerize -DestinationPath festerize_windows.zip - - name: Upload Window Release Assets - uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - files: festerize_windows.zip + - + name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - + name: Set up Go + uses: actions/setup-go@v5 + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: '~> v2' + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} diff --git a/.gitignore b/.gitignore index 04eb428..306ce0a 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,5 @@ festerize # Output directory for results /output + +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..06d7fb4 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,39 @@ +version: 2 + +project_name: festerize + +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin +archives: + - format: zip + # this name template makes the OS and Arch compatible with the results of uname. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + # use zip for windows archives + format_overrides: + - goos: linux + format: tar.gz +brews: + - repository: + owner: UCLALibrary + name: homebrew-festerize + token: "{{ .Env.PERSONAL_ACCESS_TOKEN }}" + description: "Uploads CSV files to the Fester IIIF manifest service for processing" + name: "festerize" + homepage: "https://github.com/UCLALibrary/go-festerize" + install: | + bin.install "festerize" From b64a68fb0cad99be4907d830a208c1974e1ce220 Mon Sep 17 00:00:00 2001 From: angelahuqing Date: Tue, 5 Nov 2024 11:42:08 -0800 Subject: [PATCH 2/2] [SERV-1172] Update README.md with homebrew instructions --- README.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0fe07f3..f79ac23 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,25 @@ Note that the order of operations is important. The following will result in an ## Installation -First, ensure that you have Go Version 1.22 on you system. Clone this repository and run +### Build from Source -`go build -o festerize main.go` +First, ensure that you have the latest Go version on your system. Clone this repository and run + + go build -o festerize main.go + +### Build with Homebrew + +Begin by tapping into our homebrew-festerize respository + + brew tap UCLALibrary/homebrew-festerize + +Next, you'll need to install `festerize` on your system. Please ensure that there are no other programs named `festerize` installed, as this could lead to conflicts. + + brew install festerize + +Festerize will now be installed and can be run with + + festerize ## Usage