Skip to content

Commit

Permalink
Bug fixes (#31)
Browse files Browse the repository at this point in the history
* Bug fixes

* Move MacOS out because CGO

* linux arm64 separate

* Specify main

* Forget linux/arm64 for now
  • Loading branch information
jhotmann authored Feb 5, 2023
1 parent a978b9f commit 8d2d422
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 39 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ 'main' ]

jobs:
main_build:
main:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -24,7 +24,7 @@ jobs:
with:
distribution: goreleaser
version: latest
args: build -f build/goreleaser.yml --rm-dist --snapshot --id default --id windows-tray
args: build -f build/goreleaser.yml --clean --snapshot --id default --id windows-tray
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
Expand All @@ -50,7 +50,7 @@ jobs:
# with:
# distribution: goreleaser
# version: latest
# args: build -f build/goreleaser.yml --rm-dist --snapshot --id linux-amd --id windows
# args: build -f build/goreleaser.yml --clean --snapshot --id linux-amd --id windows
# - name: Upload Artifact
# uses: actions/upload-artifact@v3
# with:
Expand All @@ -59,7 +59,7 @@ jobs:
# dist/**/clipshift
# dist/**/clipshift.exe

# build2:
# linux-arm64:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
Expand All @@ -71,7 +71,7 @@ jobs:
# arch: aarch64
# distro: bullseye
# run: |
# apt-get update && apt-get install -y gcc libgtk-3-dev libayatana-appindicator3-dev curl git
# apt-get update && apt-get install -y gcc libx11-dev libgtk-3-dev libayatana-appindicator3-dev curl git
# # golang
# echo "Downloading and Installing Go"
# curl -Lo go.tar.gz https://go.dev/dl/go1.19.5.linux-arm64.tar.gz
Expand All @@ -84,14 +84,14 @@ jobs:
# echo "Extracting Goreleaser"
# tar -xf goreleaser.tar.gz -C /usr/local/bin
# echo "Building"
# /usr/local/bin/goreleaser build -f build/goreleaser.yml --rm-dist --snapshot --id linux-arm
# /usr/local/bin/goreleaser build -f build/goreleaser.yml --clean --snapshot --id linux-arm
# - name: Upload Artifact
# uses: actions/upload-artifact@v3
# with:
# name: build2-artifacts
# path: dist/**/clipshift

mac_tray:
mac:
runs-on: macos-latest
steps:
- name: Checkout
Expand All @@ -105,7 +105,7 @@ jobs:
with:
distribution: goreleaser
version: latest
args: build -f build/goreleaser.yml --rm-dist --snapshot --id darwin-amd-tray
args: build -f build/goreleaser.yml --clean --snapshot --id darwin --id darwin-amd-tray
- name: Create App Bundle
run: ./build/macpackage.sh "darwin-amd-tray_darwin_amd64_v1" "clipshift-amd64.app"
- name: Upload Artifacts
Expand Down
23 changes: 21 additions & 2 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,30 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: '^1.19'
- name: Build tray-less all platforms, Windows w/ tray
- name: Package Linux/Windows
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release -f build/goreleaser.release.yml --rm-dist
args: release -f build/goreleaser.release.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_TOKEN }}

package-mac:
needs: package
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: '^1.19'
- name: Package MacOS
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release -f build/goreleaser.release.mac.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_TOKEN }}
42 changes: 42 additions & 0 deletions build/goreleaser.release.mac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
before:
hooks:
- go mod tidy
builds:
- binary: clipshift
goos:
- darwin
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=1
snapshot:
name_template: "{{ incpatch .Version }}-next"
archives:
- format: tar.gz
format_overrides:
- goos: windows
format: zip
files:
- qwertyasdf*
rlcp: true
checksum:
name_template: "{{ .Version }}_checksums.txt"
release:
github:
owner: getclipshift
name: clipshift
mode: keep-existing
draft: false
prerelease: auto
brews:
- ids:
- darwin
tap:
owner: getclipshift
name: homebrew-tap
homepage: "https://github.com/getclipshift/clipshift"
license: "MIT"
skip_upload: auto
test: |
system "#{bin}/clipshift"
17 changes: 5 additions & 12 deletions build/goreleaser.release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ before:
builds:
- binary: clipshift
goos:
- darwin
- linux
- windows
goarch:
- amd64
- arm64
ignore:
- goos: linux
goarch: arm64
env:
- CGO_enabled=1
- CGO_ENABLED=1
snapshot:
name_template: "{{ incpatch .Version }}-next"
archives:
Expand All @@ -31,13 +33,4 @@ release:
name: clipshift
draft: false
discussion_category_name: General
prerelease: auto
brews:
- tap:
owner: getclipshift
name: homebrew-tap
homepage: "https://github.com/getclipshift/clipshift"
license: "MIT"
skip_upload: auto
test: |
system "#{bin}/clipshift"
prerelease: auto
43 changes: 26 additions & 17 deletions build/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,25 @@ builds:
- id: default
binary: clipshift
goos:
- darwin
- linux
- windows
goarch:
- amd64
- arm64
env:
- CGO_enabled=1
- CGO_ENABLED=1
ignore:
- goos: linux
goarch: arm64
- id: darwin
binary: clipshift
goos:
- darwin
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=1
- id: darwin-amd-tray
binary: clipshift
tags:
Expand All @@ -23,7 +34,7 @@ builds:
goarch:
- amd64
env:
- CGO_enabled=1
- CGO_ENABLED=1
- id: darwin-arm-tray
binary: clipshift
tags:
Expand All @@ -33,7 +44,7 @@ builds:
goarch:
- arm64
env:
- CGO_enabled=1
- CGO_ENABLED=1
# - id: linux-amd
# binary: clipshift
# main: main.go
Expand All @@ -42,20 +53,18 @@ builds:
# goarch:
# - amd64
# env:
# - CGO_enabled=1
# - CGO_ENABLED=1
# - CC=x86_64-linux-gnu-gcc
# - CCX=x86_64-linux-gnu-g++
# - id: linux-arm
# binary: clipshift
# main: main.go
# goos:
# - linux
# goarch:
# - arm64
# env:
# - CGO_enabled=1
# - CC=aarch64-linux-gnu-gcc
# - CCX=aarch64-linux-gnu-g++
- id: linux-arm
binary: clipshift
main: ./main.go
goos:
- linux
goarch:
- arm64
env:
- CGO_ENABLED=1
- id: windows-tray
binary: clipshift-tray
tags:
Expand All @@ -68,6 +77,6 @@ builds:
- amd64
- arm64
env:
- CGO_enabled=1
- CGO_ENABLED=1
snapshot:
name_template: "{{ incpatch .Version }}-next"
6 changes: 6 additions & 0 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"fmt"
"os"
"path/filepath"

"github.com/jhotmann/clipshift/backends"
"github.com/nbd-wtf/go-nostr"
Expand Down Expand Up @@ -37,6 +38,11 @@ func writeConfig() error {
log.WithError(err).Println("Error converting config to yaml")
return err
}
err = os.MkdirAll(filepath.Dir(viper.ConfigFileUsed()), 0755)
if err != nil {
log.WithError(err).Error("Error creating config directory")
return err
}
err = os.WriteFile(viper.ConfigFileUsed(), out, 0755)
if err != nil {
log.WithError(err).Println("Error writing config file")
Expand Down

0 comments on commit 8d2d422

Please sign in to comment.