Skip to content

Commit

Permalink
fix darwin asset upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoisaiah committed Nov 25, 2023
1 parent f6bfe9c commit 1868f80
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 8 deletions.
50 changes: 42 additions & 8 deletions .github/workflows/darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
10 changes: 10 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}" }'

0 comments on commit 1868f80

Please sign in to comment.