diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..876230d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,62 @@ +name: Release DMG + +on: + push: + tags: + - 'v*' + +jobs: + build: + runs-on: macos-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Select Xcode + run: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer + + - name: Build Universal Binary + run: | + xcodebuild \ + -project StockMonitor/StockMonitor.xcodeproj \ + -scheme StockMonitor \ + -configuration Release \ + -derivedDataPath build \ + ARCHS="arm64 x86_64" \ + ONLY_ACTIVE_ARCH=NO \ + CODE_SIGN_IDENTITY="-" \ + CODE_SIGNING_REQUIRED=NO \ + CODE_SIGNING_ALLOWED=NO + + - name: Locate .app + id: locate + run: | + APP_PATH=$(find build -name "StockMonitor.app" -maxdepth 6 | head -1) + echo "app_path=$APP_PATH" >> "$GITHUB_OUTPUT" + + - name: Create DMG + run: | + APP_PATH="${{ steps.locate.outputs.app_path }}" + VERSION="${GITHUB_REF_NAME}" + DMG_NAME="StockMonitor-${VERSION}.dmg" + + mkdir -p dmg_staging + cp -R "$APP_PATH" dmg_staging/ + + hdiutil create \ + -volname "StockMonitor ${VERSION}" \ + -srcfolder dmg_staging \ + -ov \ + -format UDZO \ + "$DMG_NAME" + + echo "DMG created: $DMG_NAME" + + - name: Upload Release + uses: softprops/action-gh-release@v2 + with: + files: StockMonitor-*.dmg + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}