Fix xcodebuild project path in build.yml #61
This file contains hidden or 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 | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| jobs: | |
| build: | |
| runs-on: macos-latest | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| - name: select xcode | |
| run: sudo xcode-select -s /Applications/Xcode.app | |
| - name: show xcode version | |
| run: xcodebuild -version | |
| - name: build | |
| run: | | |
| xcodebuild \ | |
| -project lara.xcodeproj \ | |
| -scheme lara \ | |
| -configuration Debug \ | |
| -sdk iphoneos \ | |
| CODE_SIGNING_ALLOWED=NO \ | |
| CODE_SIGNING_REQUIRED=NO \ | |
| CODE_SIGN_IDENTITY="" \ | |
| archive \ | |
| -archivePath $PWD/build/lara.xcarchive | |
| xcodebuild -exportArchive \ | |
| -archivePath $PWD/build/lara.xcarchive \ | |
| -exportPath $PWD/build \ | |
| -exportOptionsPlist <(cat <<EOF<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>method</key><string>ad-hoc</string><key>compileBitcode</key><false/><key>signingStyle</key><string>automatic</string></dict></plist>EOF) | |
| - name: set up git user | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| - name: create release tag | |
| id: tag | |
| run: | | |
| TAG="build_$(date +'%Y%m%d%H%M%S')-$(git rev-parse --short HEAD)" | |
| echo "TAG=$TAG" >> $GITHUB_ENV | |
| git tag $TAG | |
| git push origin $TAG | |
| - name: get last 12h commits | |
| id: commits | |
| run: | | |
| COMMITS=$(git log --since="12 hours ago" --pretty=format:"- %h %s (%an)") | |
| # Use fallback text if no commits | |
| if [ -z "$COMMITS" ]; then | |
| COMMITS="No commits in the last 12 hours" | |
| fi | |
| echo "COMMITS<<EOF" >> $GITHUB_ENV | |
| echo "$COMMITS" >> $GITHUB_ENV | |
| echo "EOF" >> $GITHUB_ENV | |
| - name: delete old release | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const releases = await github.rest.repos.listReleases({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo | |
| }); | |
| const latestRelease = releases.data.find(r => r.tag_name === 'latest'); | |
| if (latestRelease) { | |
| await github.rest.repos.deleteRelease({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| release_id: latestRelease.id | |
| }); | |
| } | |
| - name: create new release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: latest | |
| name: Latest Build | |
| body: ${{ env.COMMITS }} | |
| files: build/lara.ipa | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |