-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathMakefile
More file actions
151 lines (136 loc) Β· 6.07 KB
/
Makefile
File metadata and controls
151 lines (136 loc) Β· 6.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Set default goal
.DEFAULT_GOAL := help
# Configure shell for safer execution
SHELL := /bin/bash
.SHELLFLAGS := -euo pipefail -c
.PHONY: help
help: ## Print comprehensive help for all commands
@echo "π§ Convos iOS Development Commands"
@echo "=================================="
@echo ""
@echo "π Secrets Management:"
@echo " make secrets - Generate Secrets.swift for CI/CD"
@echo " make secrets-local - Generate Secrets.swift for local development"
@echo " make mock-env - Generate mock environment for PR builds"
@echo ""
@echo "π± Version Management:"
@echo " make version - Show current version from Xcode project"
@echo " make dry-run-release - Test release workflow with confirmation"
@echo " make dry-run-release-quick - Quick test without confirmation"
@echo " make tag-release - Create and push a release tag (triggers GitHub Actions and Bitrise build for dev)"
@echo " make promote-release - Fast-forward merge dev to main (after tag-release, triggers Bitrise build for prod)"
@echo ""
@echo "π§ Setup & Maintenance:"
@echo " make setup - Setup development environment"
@echo " make clean - Clean all generated files and build artifacts"
@echo " make status - Show project status"
@echo " make protobuf - Generate Swift code from Protocol Buffer definitions"
@echo ""
@echo "π Environment Configuration:"
@echo " β’ Local: org.convos.ios (local development, no CI)"
@echo " β’ Dev: org.convos.ios-preview (TestFlight internal, CI: dev branch)"
@echo " β’ Prod: org.convos.ios (App Store, CI: main branch)"
@echo ""
@echo "π Build Workflow:"
@echo " β’ Local: Version from Xcode, Build always 1"
@echo " β’ Dev: Version from Xcode, Build from BITRISE_BUILD_NUMBER"
@echo " β’ Prod: Version from Xcode, Build from BITRISE_BUILD_NUMBER"
@echo ""
@echo "π Release Process:"
@echo " 1. Feature branches β dev"
@echo " 2. Create release: make tag-release (triggers GitHub Actions and Bitrise build for dev)"
@echo " 3. Promote release: make promote-release (dev β main, triggers Bitrise build for prod)"
@echo " 4. Main β App Store (after review and approval)"
.PHONY: setup
setup: ## Setup dependencies and developer environment
./Scripts/setup.sh
.PHONY: secrets
secrets: ## Generate Secrets.swift (auto-detects environment)
@if [ -n "$$CI" ] || [ -n "$$BITRISE" ]; then echo "π§ CI/CD environment detected, using secure secrets..."; ./Scripts/generate-secrets-secure.sh; else echo "π Local environment detected, using local secrets..."; ./Scripts/generate-secrets-local.sh; fi
.PHONY: secrets-local
secrets-local: ## Generate Secrets.swift with auto-detected local IP
./Scripts/generate-secrets-local.sh
.PHONY: ensure-secrets
ensure-secrets: ## Ensure minimal Secrets.swift exists
./Scripts/generate-secrets-local.sh --ensure-only
.PHONY: mock-env
mock-env: ## Generate a mock .env file for PR builds
./Scripts/generate-mock-env.sh
.PHONY: version
version: ## Get current version from Xcode project
./Scripts/get-version.sh
.PHONY: clean
clean: ## Clean generated files
rm -f Convos/Config/Secrets.swift
rm -rf build/
rm -rf DerivedData/
rm -rf *.xcarchive
rm -rf *.ipa
.PHONY: status
status: ## Show project status (version, secrets, git)
@echo "π± Project Status"
@echo "=================="
@echo "Version: $$(./Scripts/get-version.sh)"
@echo "Build Number: Managed by Bitrise (BITRISE_BUILD_NUMBER)"
@echo "Secrets: $$(if [ -f Convos/Config/Secrets.swift ]; then echo "β
Generated"; else echo "β Missing"; fi)"
@echo "Git: $$(git rev-parse --abbrev-ref HEAD) ($$(git rev-parse --short HEAD))"
@echo "Environment: $$(if [ -f .env ]; then echo "β
.env exists"; else echo "β No .env"; fi)"
@echo ""
@echo "π Current Environment:"
@echo " β’ Local: org.convos.ios (local development, no CI)"
@echo " β’ Dev: org.convos.ios-preview (TestFlight internal, CI: dev branch)"
@echo " β’ Prod: org.convos.ios (App Store, CI: main branch)"
.PHONY: protobuf
protobuf: ## Generate Swift code from Protocol Buffer definitions
@echo "π§ Generating Swift code from Protocol Buffer definitions..."
@ConvosCore/Sources/ConvosCore/Protobuf\ Models/proto/generate_swift.sh
.PHONY: tag-release
tag-release: ## Create and push a release tag (triggers GitHub Actions)
./Scripts/create-release-tag.sh
.PHONY: promote-release
promote-release: ## Fast-forward merge dev to main (ensures tag exists on both branches)
@echo "π Promote Release: dev β main"
@echo "================================"
@echo ""
@echo "This will:"
@echo " 1. Checkout main branch"
@echo " 2. Pull latest main from origin"
@echo " 3. Fast-forward merge dev into main"
@echo " 4. Push main to origin"
@echo " 5. Ensure the release tag exists on both branches"
@echo ""
@read -p "Continue? (y/N): " CONFIRM; \
if [[ ! "$$CONFIRM" =~ ^[Yy]$$ ]]; then \
echo "β Release promotion cancelled"; \
exit 1; \
fi
@echo ""
@echo "π Starting release promotion..."
@# Checkout main branch
@git checkout main
@# Pull latest main
@git pull origin main
@# Fast-forward merge dev into main
@git merge --ff-only dev
@# Push main to origin
@git push origin main
@echo ""
@echo "β
Release promotion completed successfully!"
@echo " β’ dev has been merged into main"
@echo " β’ Tag exists on both branches"
@echo " β’ Bitrise will now build and deploy to TestFlight"
.PHONY: dry-run-release
dry-run-release: ## Test release workflow without making changes (dry run)
@echo "π DRY RUN MODE: Testing release workflow..."
@echo "This will show what would happen without making actual changes."
@echo ""
@echo "To proceed with a real release, use: make tag-release"
@echo ""
@read -p "Press Enter to continue with dry run, or Ctrl+C to cancel... "
./Scripts/create-release-tag.sh --dry-run
.PHONY: dry-run-release-quick
dry-run-release-quick: ## Quick dry run without user interaction
@echo "π QUICK DRY RUN: Testing release workflow..."
@echo "This will simulate the release process without making changes."
@echo ""
./Scripts/create-release-tag.sh --dry-run