Skip to content

Commit

Permalink
Merge pull request #113 from ezhil56x/ci
Browse files Browse the repository at this point in the history
ci: release cross platform
  • Loading branch information
poundifdef committed Mar 15, 2024
2 parents 00d6091 + 2d7858c commit 5b6964b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 44 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/release.yml
@@ -1,17 +1,13 @@
# .github/workflows/release.yml
name: goreleaser

on:
pull_request:
push:
# run only against tags
tags:
- "*"
- '*'

permissions:
contents: write
# packages: write
# issues: write

jobs:
goreleaser:
Expand All @@ -21,21 +17,21 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
# More assembly might be required: Docker logins, GPG, etc.
# It all depends on your needs.

- name: Install osx-cross
uses: mbround18/setup-osxcross@v1
with:
osx-version: '12.3'

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
84 changes: 51 additions & 33 deletions .goreleaser.yaml
@@ -1,45 +1,63 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
project_name: scratchdata

dist: .builds
env:
- CGO_ENABLED=1

builds:
- env:
# linux amd64
- id: scratchdata-linux-amd64
binary: scratchdata
main: ./
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc
- CXX=x86_64-linux-gnu-g++
goos:
- linux
- windows
goarch:
- amd64

# darwin arm64
- id: scratchdata-darwin-arm64
binary: scratchdata
main: ./
env:
- CGO_ENABLED=1
- CC=oa64-clang
- CXX=oa64-clang++
goos:
- darwin
goarch:
- arm64

# darwin amd64
- id: scratchdata-darwin-amd64
binary: scratchdata
main: ./
env:
- CGO_ENABLED=1
- CC=oa64-clang
- CXX=oa64-clang++
goos:
- darwin
goarch:
- amd64

archives:
- format: tar.gz
# 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: windows
format: zip
- id: scratchdata
allow_different_binary_count: true
builds:
- scratchdata-linux-amd64
- scratchdata-darwin-arm64
- scratchdata-darwin-amd64
name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}'
wrap_in_directory: true
format: tar.gz

checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
name_template: '{{ incpatch .Version }}-next'
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

# The lines beneath this are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

0 comments on commit 5b6964b

Please sign in to comment.