Skip to content

Commit 072c9d6

Browse files
committed
👷 add GitHub action build workflow
1 parent 524b097 commit 072c9d6

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

.github/workflows/build.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
pull_request:
7+
branches: ['main']
8+
create:
9+
tags: ['v[0-9]+.[0-9]+.[0-9]+']
10+
11+
jobs:
12+
build:
13+
name: Xcode Build
14+
runs-on: macos-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v3
18+
19+
- name: Set Build Version
20+
if: ${{ github.ref_type == 'tag' }}
21+
run: 'agvtool new-marketing-version "${GITHUB_REF_NAME#v}" && agvtool new-version -all "$GITHUB_RUN_NUMBER"'
22+
23+
- name: Run xcodebuild
24+
run: 'xcodebuild -workspace ./BeezyLight.xcodeproj/project.xcworkspace -scheme BeezyLight -configuration Release -destination "generic/platform=macOS" -archivePath "$PWD/build/Release/BeezyLight.xcarchive" archive'
25+
26+
- name: Compress app bundle
27+
run: 'ditto -c -k --sequesterRsrc --keepParent "build/Release/BeezyLight.xcarchive/Products/Applications/BeezyLight.app" "build/Release/BeezyLight.zip"'
28+
29+
- name: Upload app artifact
30+
uses: actions/upload-artifact@v3
31+
with:
32+
name: app
33+
path: build/Release/BeezyLight.zip
34+
35+
- name: Create Release
36+
if: ${{ github.ref_type == 'tag' }}
37+
id: create_release
38+
uses: actions/create-release@v1
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
with:
42+
tag_name: ${{ github.ref_name }}
43+
release_name: ${{ github.ref_name }}
44+
draft: true
45+
prerelease: false
46+
47+
- name: Upload Release Asset
48+
if: ${{ github.ref_type == 'tag' }}
49+
uses: actions/upload-release-asset@v1
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
with:
53+
upload_url: ${{ steps.create_release.outputs.upload_url }}
54+
asset_path: ./build/Release/BeezyLight.zip
55+
asset_name: BeezyLight.zip
56+
asset_content_type: application/zip
57+
58+
- name: Publish Release
59+
if: ${{ github.ref_type == 'tag' }}
60+
run: "hub release edit --draft=false -m '' \"${GITHUB_REF_NAME}\""
61+
env:
62+
GITHUB_REPOSITORY: ${{ github.repository }}
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
65+

0 commit comments

Comments
 (0)