Skip to content

Commit 66b5dce

Browse files
authored
feat: first deploy for testing ci (#4)
* feat: establishes initial monorepo structure and CI/CD (#2) * chore: initialize Flutter monorepo with Melos, configs, docs, and workflows * feat: add foundational structure with DI and clean architecture Includes error handling, Flutter integration, and example implementations demonstrating package usage. * docs: add versioning guide for Pillar monorepo with Melos Includes VERSIONING.md, updates to melos.yaml for automation (version checks, increments, pre-releases, deps), and updates to root/docs READMEs. * feat: add package for remote configuration Provides an abstraction over services like Firebase Remote Config with type safety, DI integration from pillar-core, and provider-based state management for Flutter apps. * ci: add comprehensive CI/CD workflows with quality checks and releases Includes PR checks, automated versioning, publishing, and manual release workflows. Adds documentation for setup and pipeline management to improve code quality and streamline delivery. * docs: add development and release workflow guide for Pillar Details Git Flow strategy, branching conventions, feature dev, release prep, and hotfix procedures, with emphasis on automation and best practices. * chore: enforce stricter code analysis with 120-char line limit Adds stricter analysis rules, enforces a consistent line length, and updates documentation in example files to reflect changes. * test: improve testing setup with selective scripts and docs Adds test:all script for packages with tests, excludes examples by default, and creates test:with-examples script for tolerant runs. Updates CI/CD to use test:all and adds comprehensive TESTING.md. * ci: switch pub.dev auth to credentials file with refresh token (#3) * chore: migrate package publishing from Artifactory to pub.dev Replaces Artifactory configs with pub.dev authentication via PUB_TOKEN, updates CI/CD to use `dart pub token add`, and removes old secrets. Also updates documentation to reflect the new publishing process, streamlining releases in the Dart/Flutter ecosystem. * ci: update pub.dev auth to use full credentials with auto-refresh Enables automatic token renewal in CI/CD by using the complete credentials file. Updates workflows accordingly and adds a guide on managing pub.dev credentials and token rotation best practices. * docs: add dependency management strategy and fix analysis warnings script
1 parent 1c87b46 commit 66b5dce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+7942
-25
lines changed

.commitlintrc.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"extends": ["@commitlint/config-conventional"],
3+
"rules": {
4+
"type-enum": [
5+
2,
6+
"always",
7+
[
8+
"feat",
9+
"fix",
10+
"docs",
11+
"style",
12+
"refactor",
13+
"perf",
14+
"test",
15+
"build",
16+
"ci",
17+
"chore",
18+
"revert"
19+
]
20+
],
21+
"scope-enum": [
22+
2,
23+
"always",
24+
[
25+
"core",
26+
"ui",
27+
"auth",
28+
"network",
29+
"di",
30+
"firebase",
31+
"docs",
32+
"config"
33+
]
34+
],
35+
"subject-case": [2, "never", ["sentence-case", "start-case", "pascal-case", "upper-case"]],
36+
"subject-empty": [2, "never"],
37+
"subject-full-stop": [2, "never", "."],
38+
"type-case": [2, "always", "lower-case"],
39+
"type-empty": [2, "never"]
40+
}
41+
}

.czrc

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"path": "cz-conventional-changelog",
3+
"types": {
4+
"feat": {
5+
"description": "A new feature",
6+
"title": "Features"
7+
},
8+
"fix": {
9+
"description": "A bug fix",
10+
"title": "Bug Fixes"
11+
},
12+
"docs": {
13+
"description": "Documentation only changes",
14+
"title": "Documentation"
15+
},
16+
"style": {
17+
"description": "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)",
18+
"title": "Styles"
19+
},
20+
"refactor": {
21+
"description": "A code change that neither fixes a bug nor adds a feature",
22+
"title": "Code Refactoring"
23+
},
24+
"perf": {
25+
"description": "A code change that improves performance",
26+
"title": "Performance Improvements"
27+
},
28+
"test": {
29+
"description": "Adding missing tests or correcting existing tests",
30+
"title": "Tests"
31+
},
32+
"build": {
33+
"description": "Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)",
34+
"title": "Builds"
35+
},
36+
"ci": {
37+
"description": "Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)",
38+
"title": "Continuous Integrations"
39+
},
40+
"chore": {
41+
"description": "Other changes that don't modify src or test files",
42+
"title": "Chores"
43+
},
44+
"revert": {
45+
"description": "Reverts a previous commit",
46+
"title": "Reverts"
47+
}
48+
},
49+
"scopes": [
50+
"core",
51+
"ui",
52+
"auth",
53+
"network",
54+
"di",
55+
"firebase",
56+
"docs",
57+
"config"
58+
]
59+
}

.editorconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_style = space
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
10+
[*.{dart,yaml,yml}]
11+
indent_size = 2
12+
13+
[*.{md,markdown}]
14+
trim_trailing_whitespace = false
15+
16+
[*.{sh,bash}]
17+
indent_size = 2
18+
19+
[Makefile]
20+
indent_style = tab

.fvmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"flutter": "3.35.2"
3+
}

.githooks/commit-msg

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
# Conventional Commits validation hook
4+
# This hook validates commit messages against conventional commits format
5+
6+
commit_regex='^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?: .{1,50}'
7+
8+
error_msg="❌ Invalid commit message format!
9+
10+
Your commit message should follow the Conventional Commits specification:
11+
<type>[optional scope]: <description>
12+
13+
Types:
14+
feat: A new feature
15+
fix: A bug fix
16+
docs: Documentation only changes
17+
style: Changes that do not affect the meaning of the code
18+
refactor: A code change that neither fixes a bug nor adds a feature
19+
perf: A code change that improves performance
20+
test: Adding missing tests or correcting existing tests
21+
build: Changes that affect the build system or external dependencies
22+
ci: Changes to our CI configuration files and scripts
23+
chore: Other changes that don't modify src or test files
24+
revert: Reverts a previous commit
25+
26+
Examples:
27+
✅ feat: add user authentication
28+
✅ fix(auth): resolve login validation issue
29+
✅ docs: update README with installation steps
30+
✅ refactor(api): simplify user service logic
31+
32+
Your commit message: $(cat $1)
33+
"
34+
35+
if ! grep -qE "$commit_regex" "$1"; then
36+
echo "$error_msg"
37+
exit 1
38+
fi
39+
40+
echo "✅ Commit message format is valid!"
41+
exit 0

.github/SECRETS.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# GitHub Secrets Configuration
2+
3+
This document describes the required secrets for the CI/CD pipeline.
4+
5+
## Required Secrets
6+
7+
Configure these secrets in your GitHub repository settings (`Settings > Secrets and variables > Actions`):
8+
9+
### pub.dev Configuration
10+
- **`PUB_CREDENTIALS`** - Complete credentials JSON file for pub.dev publishing (includes refresh token for auto-renewal)
11+
12+
### Optional Notification Secrets
13+
- **`SLACK_WEBHOOK_URL`** - Webhook URL for Slack notifications (optional)
14+
- **`DISCORD_WEBHOOK_URL`** - Webhook URL for Discord notifications (optional)
15+
16+
## Setting Up Secrets
17+
18+
### 1. pub.dev Setup
19+
20+
1. **Generate pub.dev token:**
21+
```bash
22+
# Login to pub.dev locally first
23+
dart pub login
24+
25+
# Get your credentials file
26+
cat ~/.pub-cache/credentials.json
27+
```
28+
29+
2. **Copy complete credentials:**
30+
- Copy the ENTIRE JSON content from the credentials.json file
31+
- Include the `refreshToken` for automatic token renewal
32+
- This is your `PUB_CREDENTIALS` value
33+
34+
3. **Add to GitHub:**
35+
- Go to repository Settings > Secrets and variables > Actions
36+
- Click "New repository secret"
37+
- Name: `PUB_CREDENTIALS`
38+
- Value: The complete JSON from step 2
39+
40+
### 2. Notification Setup (Optional)
41+
42+
#### Slack
43+
```bash
44+
# Create a Slack webhook in your workspace
45+
# Add the webhook URL as SLACK_WEBHOOK_URL secret
46+
```
47+
48+
#### Discord
49+
```bash
50+
# Create a Discord webhook in your server
51+
# Add the webhook URL as DISCORD_WEBHOOK_URL secret
52+
```
53+
54+
## Security Best Practices
55+
56+
- Use tokens with minimal required permissions
57+
- Rotate tokens regularly
58+
- Never log secret values in workflows
59+
- Use environment-specific secrets when possible
60+
61+
## Verification
62+
63+
Test your setup:
64+
```bash
65+
# Dry run to test authentication
66+
melos publish --dry-run
67+
```
68+
69+
## Troubleshooting
70+
71+
### Common Issues
72+
73+
#### pub.dev Authentication Failed
74+
```
75+
Error: 401 Unauthorized when accessing https://pub.dartlang.org
76+
```
77+
**Solution:** Check that `PUB_CREDENTIALS` contains valid JSON with both accessToken and refreshToken.
78+
79+
#### Token Expired
80+
```
81+
Error: Token has expired
82+
```
83+
**Solution:** Generate a new token using `dart pub login` and update the secret.
84+
85+
#### Missing Permissions
86+
```
87+
Error: Insufficient permissions to publish package
88+
```
89+
**Solution:** Ensure you have publisher permissions for the package on pub.dev.
90+
91+
## Token Management
92+
93+
### Rotating Tokens
94+
1. Generate new token: `dart pub login`
95+
2. Update GitHub secret with new token
96+
3. Test with dry-run: `melos publish --dry-run`
97+
98+
### Monitoring
99+
- Monitor pub.dev package dashboard
100+
- Set up alerts for failed releases
101+
- Review workflow logs regularly
102+
103+
## Package Publishing Process
104+
105+
1. **Authentication**: GitHub Actions uses `PUB_TOKEN` to authenticate
106+
2. **Validation**: Packages are validated before publishing
107+
3. **Publishing**: Only changed packages are published
108+
4. **Verification**: Success/failure is reported in workflow logs
109+
110+
For more details, see the main [CI/CD documentation](../docs/CI-CD.md).

0 commit comments

Comments
 (0)