fix 2: electric boogaloo #67
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: | |
| workflow_dispatch: | |
| 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 | |
| APP_PATH="$PWD/build/lara.xcarchive/Products/Applications/lara.app" | |
| if [ ! -d "$APP_PATH" ]; then | |
| echo "Missing app at $APP_PATH" | |
| exit 1 | |
| fi | |
| rm -rf "$PWD/build/Payload" | |
| mkdir -p "$PWD/build/Payload" | |
| cp -R "$APP_PATH" "$PWD/build/Payload/" | |
| (cd "$PWD/build" && /usr/bin/zip -qry lara.ipa Payload) | |
| - 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 }} |