From e2bea02a350051cfe8532ca1abda7fb69f33426f Mon Sep 17 00:00:00 2001 From: Ayooluwa Isaiah Date: Thu, 19 Oct 2023 16:47:26 +0200 Subject: [PATCH] automate darwin binary uploads for nightly releases --- .github/workflows/darwin.yml | 47 ++++++++++++++++++------------------ .goreleaser_darwin.yml | 30 +++++++++++++++++++++++ 2 files changed, 54 insertions(+), 23 deletions(-) create mode 100644 .goreleaser_darwin.yml diff --git a/.github/workflows/darwin.yml b/.github/workflows/darwin.yml index 9f06f6f..e9823dc 100644 --- a/.github/workflows/darwin.yml +++ b/.github/workflows/darwin.yml @@ -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 diff --git a/.goreleaser_darwin.yml b/.goreleaser_darwin.yml new file mode 100644 index 0000000..85ea42e --- /dev/null +++ b/.goreleaser_darwin.yml @@ -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'