Skip to content

Commit

Permalink
Build mac os
Browse files Browse the repository at this point in the history
  • Loading branch information
ChienNM3 committed Jan 28, 2024
1 parent 1b3e03b commit 8467bd0
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 1 deletion.
66 changes: 66 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

workflow_dispatch:

jobs:
build:
strategy:
fail-fast: true
matrix:
build:
- { name: 'TorPlayer-darwin', os: 'macos-latest' }

runs-on: ${{ matrix.build.os }}
steps:
- name: Checkout
uses: actions/checkout@v4

# Setup Golang
- name: Setup Golang
uses: actions/setup-go@v4
with:
go-version: 1.21
check-latest: true
- run: go version
shell: bash

# Build MacOS
- name: Build MacOS
if: runner.os == 'macOS'
run: |
mkdir -p ./build/bin/TorPlayer.app/Contents/MacOS
mkdir -p ./build/bin/TorPlayer.app/Contents/Resources
cp ./build/darwin/Info.plist ./build/bin/TorPlayer.app/Contents
cp ./build/darwin/iconfile.icns ./build/bin/TorPlayer.app/Contents/Resources
go build -o build/bin/TorPlayer.app/Contents/MacOS/TorPlayer
chmod +x build/bin/*/Contents/MacOS/*
shell: bash

# Package MacOS
- name: Package MacOS
if: runner.os == 'macOS'
run: |
productbuild --component ./build/bin/TorPlayer.app ./build/bin/TorPlayer.pkg
shell: bash

# Upload build assets
- uses: actions/upload-artifact@v4
with:
name: Build ${{matrix.build.name}} ${{runner.os}}
path: |
*/bin/*.pkg
*\bin\*.exe
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
*/bin/*.{pkg,exe}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
**/.DS_Store
**/.DS_Store
build/bin
29 changes: 29 additions & 0 deletions build/darwin/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleName</key>
<string>TorPlayer</string>
<key>CFBundleExecutable</key>
<string>TorPlayer</string>
<key>CFBundleIdentifier</key>
<string>com.TorPlayer</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleGetInfoString</key>
<string>Built using Go</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleIconFile</key>
<string>iconfile</string>
<key>LSMinimumSystemVersion</key>
<string>10.13.0</string>
<key>NSHighResolutionCapable</key>
<string>true</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright.........</string>


</dict>
</plist>
Binary file added build/darwin/iconfile.icns
Binary file not shown.

0 comments on commit 8467bd0

Please sign in to comment.