Skip to content

Commit

Permalink
automate darwin binary uploads for nightly releases
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoisaiah committed Oct 19, 2023
1 parent 436e150 commit e2bea02
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 23 deletions.
47 changes: 24 additions & 23 deletions .github/workflows/darwin.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
name: Build darwin
name: Upload macOS binaries

on: workflow_dispatch
env:
dev_tag: nightly

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
on:
workflow_run:
workflows: [Release Focus]
types:
- completed

jobs:
build_and_upload:
runs-on: macos-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

# Setup Go
- name: Setup Go 1.21
- name: Setup Go v1.21
uses: actions/setup-go@v3
with:
go-version: 1.21

# Tests
- name: Build binary
run: go build -o focus-darwin ./cmd/...

- name: Archive darwin binary
uses: actions/upload-artifact@v3
- name: Build assets with Goreleaser
uses: goreleaser/goreleaser-action@v4
with:
name: focus-darwin
path: focus-darwin
version: latest
args: release --clean --snapshot --config=.goreleaser_darwin.yml

- name: Upload archives to nightly release
run: gh release upload ${{ env.dev_tag }} dist/*.tar.gz dist/darwin-checksums.txt --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Download darwin binary
uses: actions/download-artifact@v3
with:
name: focus-darwin
30 changes: 30 additions & 0 deletions .goreleaser_darwin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
project_name: focus

before:
hooks:
- go mod download

builds:
- id: darwin
env:
- CGO_ENABLED=1
goos:
- darwin
goarch:
- amd64
- arm64
main: ./cmd/focus

archives:
- id: darwin
builds:
- darwin
files:
- LICENCE
- README.md
- CHANGELOG.md

checksum:
name_template: darwin-checksums.txt
snapshot:
name_template: 'master'

0 comments on commit e2bea02

Please sign in to comment.