Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SERV-1172] Add goreleaser and associated files #37

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 23 additions & 107 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
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@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
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@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
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@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
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 }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ festerize

# Output directory for results
/output

dist/
39 changes: 39 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -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
angelahuqing marked this conversation as resolved.
Show resolved Hide resolved
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:
angelahuqing marked this conversation as resolved.
Show resolved Hide resolved
- 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"
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading