Skip to content

Commit

Permalink
[SERV-1172] Add goreleaser and associated files
Browse files Browse the repository at this point in the history
  • Loading branch information
angelahuqing committed Nov 5, 2024
1 parent 66ee07f commit e961712
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 107 deletions.
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@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 }}
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
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"

0 comments on commit e961712

Please sign in to comment.