From 1868f8023bc22469bbcfff58c32be83b7cea4af9 Mon Sep 17 00:00:00 2001 From: Ayooluwa Isaiah Date: Sat, 25 Nov 2023 17:32:53 +0200 Subject: [PATCH] fix darwin asset upload --- .github/workflows/darwin.yml | 50 +++++++++++++++++++++++++++++------ .github/workflows/release.yml | 10 +++++++ 2 files changed, 52 insertions(+), 8 deletions(-) diff --git a/.github/workflows/darwin.yml b/.github/workflows/darwin.yml index e9823dc..4116a5e 100644 --- a/.github/workflows/darwin.yml +++ b/.github/workflows/darwin.yml @@ -4,15 +4,13 @@ env: dev_tag: nightly on: - workflow_run: - workflows: [Release Focus] - types: - - completed + workflow_dispatch: + repository_dispatch: + types: [darwin-build] jobs: - build_and_upload: + build: runs-on: macos-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - name: Checkout uses: actions/checkout@v4 @@ -28,8 +26,44 @@ jobs: 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 + - name: Temporarily save build assets + uses: actions/upload-artifact@v3 + with: + name: darwin-artifacts + path: dist + retention-days: 1 + + upload: + runs-on: macos-latest + needs: build + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Retrieve saved build assets + uses: actions/download-artifact@v3 + with: + name: darwin-artifacts + path: dist + + - name: Upload assets to nightly release + if: github.event_name == 'workflow_dispatch' + run: | + gh release upload ${{ env.dev_tag }} dist/*.tar.gz dist/darwin-checksums.txt --clobber env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload assets to latest release + if: github.event_name == 'repository_dispatch' + run: | + if [ ${{ github.event.client_payload.ref }} == 'master' ]; then + gh release upload ${{ env.dev_tag }} dist/*.tar.gz dist/darwin-checksums.txt --clobber + else + gh release upload ${{ github.event.client_payload.ref }} dist/*.tar.gz dist/darwin-checksums.txt --clobber + fi + + echo "${{ github.event.client_payload.ref }}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1f74096..41b5ee5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -135,3 +135,13 @@ jobs: GORELEASER_GITHUB_TOKEN: ${{ secrets.SCOOP_BUCKET_GITHUB_TOKEN }} FURY_PUSH_TOKEN: ${{ secrets.FURY_PUSH_TOKEN }} FURY_USERNAME: ${{ secrets.FURY_USERNAME }} + + dispatch_darwin: + name: Trigger action to build and upload macOS binaries + runs-on: ubuntu-latest + steps: + - name: Trigger Darwin build + uses: peter-evans/repository-dispatch@v2 + with: + event-type: darwin-build + client-payload: '{"ref": "${{ github.ref_name }}" }'