Update GitHub Actions workflow to use GH_PAT #56
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: buildnrelease | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| jobs: | |
| build-and-release: | |
| runs-on: macos-latest | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_PAT }} | |
| steps: | |
| - name: Checkout repository | |
| 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="" \ | |
| build | |
| - name: handle archival | |
| id: handle_release | |
| run: | | |
| LATEST=$(gh release list --limit 1 --json tagName,createdAt | jq -r '.[0].tagName') | |
| if [ "$LATEST" != "null" ]; then | |
| SHA=$(gh release view "$LATEST" --json targetCommitish -q '.targetCommitish') | |
| gh release create "${LATEST}-old" --target "$SHA" --notes "Old release tag" | |
| gh release delete "$LATEST" --yes | |
| - name: new release | |
| run: | | |
| COMMITS=$(git log --since="12 hours ago" --pretty=format:"- %s (%an)") | |
| TAG="latest ($(date +%Y%m%d%H%M%S))" | |
| gh release create "$TAG" tree/main/build/Debug-iphonesimulator/lara.ipa \ | |
| --title "$TAG" \ | |
| --notes "$COMMITS" \ | |
| --prerelease |