From b01dca5c4337ef607d4b78bb83db4393d532b3de Mon Sep 17 00:00:00 2001 From: Mak5er Date: Tue, 11 Aug 2026 05:30:57 +0300 Subject: [PATCH] Fix release workflow: use gh CLI to publish IPA Replace softprops action with gh release create/upload so tags auto-publish Pocket_Poster.ipa on GitHub Releases. --- .github/workflows/release.yml | 115 ++++++++++++++++++---------------- 1 file changed, 61 insertions(+), 54 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0aeb587..5295841 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,39 +3,34 @@ name: Release IPA on: push: tags: - - 'v*' + - "v*" workflow_dispatch: inputs: tag: - description: 'Release tag (e.g. v3.2.2). Leave empty to use MARKETING_VERSION.' + description: "Optional tag override (e.g. v3.2.2)" required: false - default: '' + type: string + default: "" permissions: contents: write -concurrency: - group: release-${{ github.ref }} - cancel-in-progress: false - jobs: release: - name: Build & publish release + name: Build and release IPA runs-on: macos-15 - timeout-minutes: 45 + timeout-minutes: 60 steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Select Xcode run: | sudo xcode-select -s /Applications/Xcode.app/Contents/Developer xcodebuild -version - - name: Resolve packages + - name: Resolve Swift packages run: | xcodebuild -project "Pocket Poster.xcodeproj" \ -scheme "Pocket Poster" \ @@ -46,7 +41,7 @@ jobs: chmod +x ./ipabuild.sh ./ipabuild.sh - - name: Prepare release files + - name: Package release assets id: meta run: | set -euo pipefail @@ -57,56 +52,68 @@ jobs: if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.tag }}" ]; then TAG="${{ inputs.tag }}" - elif [[ "${{ github.ref }}" == refs/tags/* ]]; then + elif [ "${GITHUB_REF_TYPE}" = "tag" ]; then TAG="${GITHUB_REF_NAME}" else TAG="v${VERSION}" fi - # ipabuild.sh emits Pocket_Poster.ipa (+ legacy name) - test -f "build/Pocket_Poster.ipa" || cp "build/Pocket Poster.ipa" "build/Pocket_Poster.ipa" - cp "build/Pocket_Poster.ipa" "build/Pocket_Poster_${VERSION}.ipa" + test -f build/Pocket_Poster.ipa || cp "build/Pocket Poster.ipa" build/Pocket_Poster.ipa + cp build/Pocket_Poster.ipa "build/Pocket_Poster_${VERSION}.ipa" + + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "build=${BUILD}" >> "$GITHUB_OUTPUT" + echo "bundle_id=${BUNDLE_ID}" >> "$GITHUB_OUTPUT" + echo "tag=${TAG}" >> "$GITHUB_OUTPUT" { - echo "version=$VERSION" - echo "build=$BUILD" - echo "bundle_id=$BUNDLE_ID" - echo "tag=$TAG" - } >> "$GITHUB_OUTPUT" - - cat > release_notes.md < release_notes.md ls -lh build/*.ipa - echo "Tag: $TAG Version: $VERSION" + echo "Publishing tag=${TAG} version=${VERSION}" - name: Create GitHub Release - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ steps.meta.outputs.tag }} - name: Pocket Poster ${{ steps.meta.outputs.version }} - body_path: release_notes.md - draft: false - prerelease: false - generate_release_notes: true - files: | - build/Pocket_Poster.ipa - build/Pocket_Poster_${{ steps.meta.outputs.version }}.ipa env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + TAG="${{ steps.meta.outputs.tag }}" + VERSION="${{ steps.meta.outputs.version }}" + + # Create tag on current commit if dispatch without existing tag + if ! git rev-parse "$TAG" >/dev/null 2>&1; then + git tag "$TAG" + git push origin "$TAG" || true + fi + + if gh release view "$TAG" >/dev/null 2>&1; then + gh release upload "$TAG" \ + build/Pocket_Poster.ipa \ + "build/Pocket_Poster_${VERSION}.ipa" \ + --clobber + gh release edit "$TAG" \ + --title "Pocket Poster ${VERSION}" \ + --notes-file release_notes.md + else + gh release create "$TAG" \ + build/Pocket_Poster.ipa \ + "build/Pocket_Poster_${VERSION}.ipa" \ + --title "Pocket Poster ${VERSION}" \ + --notes-file release_notes.md + fi