🧱 ci: fix bug in fastfile #42
Workflow file for this run
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: Deploy to App Store Connect | |
| on: | |
| push: | |
| tags: | |
| - "appstore/v*" | |
| - "testflight/v*" | |
| - "testflight/dev/v*" | |
| jobs: | |
| deploy: | |
| runs-on: macos-latest | |
| timeout-minutes: 30 | |
| defaults: | |
| run: | |
| working-directory: ./SNUTT | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Parse tag and extract deployment info | |
| id: parse_tag | |
| run: | | |
| chmod +x Scripts/parse_tag.sh | |
| eval $(Scripts/parse_tag.sh "${{ github.ref_name }}") | |
| echo "deploy_type=$DEPLOY_TYPE" >> $GITHUB_OUTPUT | |
| echo "is_dev=$IS_DEV" >> $GITHUB_OUTPUT | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Deployment type: $DEPLOY_TYPE" | |
| echo "Is Dev: $IS_DEV" | |
| echo "Version: $VERSION" | |
| - name: Validate tag is on HEAD | |
| run: | | |
| chmod +x Scripts/validate_tag.sh | |
| Scripts/validate_tag.sh "${{ github.ref_name }}" | |
| - name: Create XCConfig files from secrets | |
| run: | | |
| cat > XCConfigs/Dev.xcconfig << 'EOF' | |
| ${{ secrets.DEV_XCCONFIG }} | |
| EOF | |
| cat > XCConfigs/Prod.xcconfig << 'EOF' | |
| ${{ secrets.PROD_XCCONFIG }} | |
| EOF | |
| - name: Create GoogleService-Info.plist files | |
| run: | | |
| echo "${{ secrets.GOOGLE_SERVICE_DEBUG_INFO }}" > SNUTT/Resources/GoogleServiceDebugInfo.plist | |
| echo "${{ secrets.GOOGLE_SERVICE_RELEASE_INFO }}" > SNUTT/Resources/GoogleServiceReleaseInfo.plist | |
| - name: Setup Xcode | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: "26.0.1" | |
| - name: Setup mise (Tuist) | |
| uses: jdx/mise-action@v2 | |
| - name: Install brew dependencies | |
| run: brew install just mint | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.2" | |
| bundler-cache: true | |
| - name: Install dependencies with bundler | |
| run: bundle install | |
| - name: Install ImageMagick (for beta badge) | |
| if: steps.parse_tag.outputs.is_dev == 'true' | |
| run: | | |
| brew install imagemagick | |
| - name: Check and update version if needed | |
| run: | | |
| # Check if version matches | |
| if ! bundle exec fastlane check_version version:"${{ steps.parse_tag.outputs.version }}"; then | |
| echo "Version mismatch detected. Updating version..." | |
| # Update version | |
| bundle exec fastlane update_version version:"${{ steps.parse_tag.outputs.version }}" | |
| # Configure git | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Commit and push | |
| git add XCConfigs/Base.xcconfig | |
| git commit -m "🔖 Update version to ${{ steps.parse_tag.outputs.version }} for deployment" | |
| git push origin HEAD:${{ github.ref }} | |
| else | |
| echo "Version already matches. No update needed." | |
| fi | |
| - name: Setup git ssh - repo mapping | |
| uses: shaunco/ssh-agent@git-repo-mapping | |
| with: | |
| ssh-private-key: ${{ secrets.MATCH_DEPLOY_KEY }} | |
| repo-mappings: github.com/wafflestudio/wafflestudio-apple-certificates | |
| - name: Configure ssh agent | |
| env: | |
| GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no" | |
| MATCH_DEPLOY_KEY: ${{ secrets.MATCH_DEPLOY_KEY }} | |
| run: | | |
| eval "$(ssh-agent -s)" | |
| ssh-add - <<< "$MATCH_DEPLOY_KEY" | |
| - name: Extract release notes (App Store only) | |
| if: steps.parse_tag.outputs.deploy_type == 'appstore' | |
| id: release_notes | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| if ! gh release view "${{ github.ref_name }}" --repo wafflestudio/snutt-ios > /dev/null 2>&1; then | |
| echo "❌ Error: GitHub Release not found for tag ${{ github.ref_name }}" | |
| echo "Please create a GitHub Release with release notes before deploying to App Store." | |
| echo "" | |
| echo "Steps to create a release:" | |
| echo "1. Go to https://github.com/wafflestudio/snutt-ios/releases/new" | |
| echo "2. Choose tag: ${{ github.ref_name }}" | |
| echo "3. Write release notes in Korean" | |
| echo "4. Publish the release" | |
| exit 1 | |
| fi | |
| # Extract release notes body | |
| RELEASE_NOTES=$(gh release view "${{ github.ref_name }}" --repo wafflestudio/snutt-ios --json body --jq .body) | |
| echo "✅ GitHub Release found for ${{ github.ref_name }}" | |
| # Save to environment file for multi-line content | |
| echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV | |
| echo "$RELEASE_NOTES" >> $GITHUB_ENV | |
| echo "EOF" >> $GITHUB_ENV | |
| - name: Determine fastlane lane | |
| id: determine_lane | |
| run: | | |
| if [ "${{ steps.parse_tag.outputs.is_dev }}" == "true" ]; then | |
| echo "lane=deploy_dev_testflight" >> $GITHUB_OUTPUT | |
| echo "Lane: deploy_dev_testflight" | |
| elif [ "${{ steps.parse_tag.outputs.deploy_type }}" == "appstore" ]; then | |
| echo "lane=deploy_prod_appstore" >> $GITHUB_OUTPUT | |
| echo "Lane: deploy_prod_appstore" | |
| else | |
| echo "lane=deploy_prod_testflight" >> $GITHUB_OUTPUT | |
| echo "Lane: deploy_prod_testflight" | |
| fi | |
| - name: Deploy with Fastlane | |
| env: | |
| MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} | |
| APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }} | |
| APP_STORE_CONNECT_KEY_ISSUER: ${{ secrets.APP_STORE_CONNECT_KEY_ISSUER }} | |
| APP_STORE_CONNECT_KEY_CONTENT: ${{ secrets.APP_STORE_CONNECT_KEY_CONTENT }} | |
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
| GIT_TAG_NAME: ${{ github.ref_name }} | |
| run: bundle exec fastlane ${{ steps.determine_lane.outputs.lane }} |