Add files via upload #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build macOS App | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: "npm" | |
- name: Install Dependencies | |
run: npm install | |
- name: Set GRIDCAST_TOKEN for Electron Builder | |
run: echo "GH_TOKEN=${{ secrets.GRIDCAST_TOKEN }}" >> $GITHUB_ENV | |
- name: Build DMG for macOS (Both x64 and arm64) | |
run: npm run build:macos-prod | |
- name: List dist directory contents | |
run: ls -la dist | |
- name: Get the current commit hash | |
id: get_commit | |
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.COMMIT_HASH }} | |
release_name: GridCast ${{ env.COMMIT_HASH }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset (x64) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: dist/GridCast-1.0.0.dmg | |
asset_name: GridCast-1.0.0.dmg | |
asset_content_type: application/octet-stream | |
- name: Upload Release Asset (arm64) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: dist/GridCast-1.0.0-arm64.dmg | |
asset_name: GridCast-1.0.0-arm64.dmg | |
asset_content_type: application/octet-stream |