Skip to content

Commit

Permalink
👷 add GitHub action build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardodino committed Mar 16, 2022
1 parent 524b097 commit 072c9d6
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build

on:
push:
branches: ['main']
pull_request:
branches: ['main']
create:
tags: ['v[0-9]+.[0-9]+.[0-9]+']

jobs:
build:
name: Xcode Build
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set Build Version
if: ${{ github.ref_type == 'tag' }}
run: 'agvtool new-marketing-version "${GITHUB_REF_NAME#v}" && agvtool new-version -all "$GITHUB_RUN_NUMBER"'

- name: Run xcodebuild
run: 'xcodebuild -workspace ./BeezyLight.xcodeproj/project.xcworkspace -scheme BeezyLight -configuration Release -destination "generic/platform=macOS" -archivePath "$PWD/build/Release/BeezyLight.xcarchive" archive'

- name: Compress app bundle
run: 'ditto -c -k --sequesterRsrc --keepParent "build/Release/BeezyLight.xcarchive/Products/Applications/BeezyLight.app" "build/Release/BeezyLight.zip"'

- name: Upload app artifact
uses: actions/upload-artifact@v3
with:
name: app
path: build/Release/BeezyLight.zip

- name: Create Release
if: ${{ github.ref_type == 'tag' }}
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}
draft: true
prerelease: false

- name: Upload Release Asset
if: ${{ github.ref_type == 'tag' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/Release/BeezyLight.zip
asset_name: BeezyLight.zip
asset_content_type: application/zip

- name: Publish Release
if: ${{ github.ref_type == 'tag' }}
run: "hub release edit --draft=false -m '' \"${GITHUB_REF_NAME}\""
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


0 comments on commit 072c9d6

Please sign in to comment.