@@ -70,118 +70,37 @@ check_secret() {
7070
7171# Check essential secrets
7272MISSING_SECRETS=0
73- check_secret " GITHUB_TOKEN " " false " || true # Auto-provided by GitHub Actions
73+ check_secret " RELEASE_TOKEN " " true " || (( MISSING_SECRETS ++ ))
7474check_secret " AUR_SSH_PRIVATE_KEY" " true" || (( MISSING_SECRETS++ ))
75+ check_secret " GPG_PRIVATE_KEY" " true" || (( MISSING_SECRETS++ ))
76+ check_secret " GPG_FINGERPRINT" " true" || (( MISSING_SECRETS++ ))
7577
76- if [[ $MISSING_SECRETS -gt 0 ]]; then
77- print_warning " Some secrets are missing - publishing will fail "
78+ if [[ $MISSING_SECRETS -eq 0 ]]; then
79+ print_success " All secrets configured ✅ "
7880else
79- print_success " All required secrets are configured"
81+ print_warning " $MISSING_SECRETS required secrets missing ⚠️"
82+ exit 1
8083fi
8184echo
8285
83- # 3. Build test (without publishing)
84- print_status " 3. Testing build process (no publishing)..."
85-
86- # Set dummy environment variables for testing
87- export GITHUB_TOKEN=" dummy"
88- export AUR_KEY=" dummy"
89- export GPG_KEY_FILE=" dummy"
86+ # 3. GoReleaser Test (without publishing)
87+ print_status " 3. Testing GoReleaser process (no publishing)..."
9088
9189# Base skip flags - always skip these for testing
9290SKIP_FLAGS=" --skip=publish --skip=sign --skip=validate"
9391
94- # Install missing tools for local testing
95- print_status " 3a. Checking and installing required tools..."
96-
97- # Create temporary bin directory for this test session
98- TEMP_BIN_DIR=$( mktemp -d) /bin
99- mkdir -p " $TEMP_BIN_DIR "
100- export PATH=" $TEMP_BIN_DIR :$PATH "
101-
102- if go tool goreleaser release --snapshot --clean $SKIP_FLAGS 2> /dev/null; then
103- print_success " Build process completed successfully"
104-
105- # Check generated artifacts
106- print_status " 4. Checking generated artifacts..."
107-
108- if [[ -d " dist" ]]; then
109- BINARIES=$( find dist -name " emojify*" -type f | wc -l)
110- ARCHIVES=$( find dist -name " *.tar.gz" -o -name " *.zip" | wc -l)
111-
112- print_success " Generated $BINARIES binaries"
113- print_success " Generated $ARCHIVES archives"
114-
115- # List some key files
116- echo " Key artifacts:"
117- find dist -maxdepth 1 \( -name " *.tar.gz" -o -name " *.zip" -o -name " checksums.txt" \) | head -5 | sed ' s/^/ - /'
118- else
119- print_error " No dist directory found"
120- fi
92+ if go tool goreleaser release --snapshot --clean $SKIP_FLAGS --verbose; then
93+ print_success " GoReleaser process completed successfully"
12194else
122- print_error " Build process failed"
123- echo
124- echo " Try running manually with more verbose output:"
125- echo " go tool goreleaser release --snapshot --clean --skip=publish --skip=sign --skip=validate"
95+ print_error " GoReleaser process failed"
12696 exit 1
12797fi
12898echo
12999
130- # 5. Repository access test
131- print_status " 5. Testing repository access..."
132-
133- if command -v gh > /dev/null 2>&1 ; then
134- if gh auth status > /dev/null 2>&1 ; then
135- print_success " GitHub CLI authenticated"
136-
137- # Test repository access
138- if gh repo view damienbutt/emojify-go > /dev/null 2>&1 ; then
139- print_success " Main repository accessible"
140- else
141- print_error " Cannot access main repository"
142- fi
143- else
144- print_warning " GitHub CLI not authenticated"
145- fi
146- else
147- print_warning " GitHub CLI not installed"
148- fi
149- echo
150-
151100# 6. Summary
152101print_status " 📋 Test Summary"
153102echo " ==============="
154103echo
155104
156- if [[ $MISSING_SECRETS -eq 0 ]]; then
157- print_success " All secrets configured ✅"
158- else
159- print_warning " $MISSING_SECRETS required secrets missing ⚠️"
160- fi
161-
162105print_success " Configuration valid ✅"
163- print_success " Build process works ✅"
164- print_success " Artifacts generated ✅"
165-
166- echo
167- if [[ $MISSING_SECRETS -eq 0 ]]; then
168- print_success " 🎉 Ready for release! All tests passed."
169- echo
170- echo " To create a release:"
171- echo " git tag v1.0.0"
172- echo " git push origin v1.0.0"
173- else
174- print_warning " ⚠️ Almost ready! Configure missing secrets first."
175- echo
176- echo " Missing secrets can be added with:"
177- echo " gh secret set SECRET_NAME"
178- fi
179-
180- echo
181- echo " Clean up test artifacts:"
182- echo " rm -rf dist/"
183-
184- # Clean up temporary tools
185- if [ -n " $TEMP_BIN_DIR " ] && [ -d " $TEMP_BIN_DIR " ]; then
186- rm -rf " $( dirname " $TEMP_BIN_DIR " ) "
187- fi
106+ print_success " GoReleaser process works ✅"
0 commit comments