attio 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. checksums.yaml +7 -0
  2. data/.codecov.yml +52 -0
  3. data/.github/CODEOWNERS +28 -0
  4. data/.github/ISSUE_TEMPLATE/bug_report.md +40 -0
  5. data/.github/ISSUE_TEMPLATE/feature_request.md +28 -0
  6. data/.github/dependabot.yml +54 -0
  7. data/.github/pull_request_template.md +40 -0
  8. data/.github/workflows/ci.yml +112 -0
  9. data/.github/workflows/dependabot-auto-merge.yml +45 -0
  10. data/.github/workflows/pr_checks.yml +145 -0
  11. data/.github/workflows/release.yml +147 -0
  12. data/.gitignore +10 -0
  13. data/.rspec +4 -0
  14. data/.rubocop.yml +133 -0
  15. data/.yardopts +18 -0
  16. data/CHANGELOG.md +34 -0
  17. data/CODE_OF_CONDUCT.md +37 -0
  18. data/CONTRIBUTING.md +280 -0
  19. data/Gemfile +17 -0
  20. data/Gemfile.lock +127 -0
  21. data/LICENSE.txt +21 -0
  22. data/README.md +292 -0
  23. data/Rakefile +57 -0
  24. data/SECURITY.md +59 -0
  25. data/attio.gemspec +34 -0
  26. data/bin/console +14 -0
  27. data/bin/setup +8 -0
  28. data/danger/Dangerfile +121 -0
  29. data/docs/.nojekyll +0 -0
  30. data/docs/Attio/AuthenticationError.html +152 -0
  31. data/docs/Attio/Client.html +1373 -0
  32. data/docs/Attio/ConnectionPool/TimeoutError.html +148 -0
  33. data/docs/Attio/ConnectionPool.html +944 -0
  34. data/docs/Attio/Error.html +152 -0
  35. data/docs/Attio/HttpClient/ConnectionError.html +152 -0
  36. data/docs/Attio/HttpClient/TimeoutError.html +152 -0
  37. data/docs/Attio/HttpClient.html +1329 -0
  38. data/docs/Attio/Logger.html +747 -0
  39. data/docs/Attio/NotFoundError.html +152 -0
  40. data/docs/Attio/RateLimitError.html +152 -0
  41. data/docs/Attio/RequestLogger.html +780 -0
  42. data/docs/Attio/Resources/Attributes.html +508 -0
  43. data/docs/Attio/Resources/Base.html +624 -0
  44. data/docs/Attio/Resources/Lists.html +1002 -0
  45. data/docs/Attio/Resources/Objects.html +415 -0
  46. data/docs/Attio/Resources/Records.html +1465 -0
  47. data/docs/Attio/Resources/Users.html +415 -0
  48. data/docs/Attio/Resources/Workspaces.html +324 -0
  49. data/docs/Attio/Resources.html +141 -0
  50. data/docs/Attio/RetryHandler.html +1023 -0
  51. data/docs/Attio/ServerError.html +152 -0
  52. data/docs/Attio/ValidationError.html +152 -0
  53. data/docs/Attio.html +397 -0
  54. data/docs/SETUP.md +117 -0
  55. data/docs/_index.html +378 -0
  56. data/docs/class_list.html +54 -0
  57. data/docs/css/common.css +1 -0
  58. data/docs/css/full_list.css +58 -0
  59. data/docs/css/style.css +503 -0
  60. data/docs/example.rb +119 -0
  61. data/docs/file.CHANGELOG.html +124 -0
  62. data/docs/file.README.html +371 -0
  63. data/docs/file_list.html +64 -0
  64. data/docs/frames.html +22 -0
  65. data/docs/index.html +371 -0
  66. data/docs/js/app.js +344 -0
  67. data/docs/js/full_list.js +242 -0
  68. data/docs/js/jquery.js +4 -0
  69. data/docs/method_list.html +750 -0
  70. data/docs/top-level-namespace.html +110 -0
  71. data/lib/attio/client.rb +118 -0
  72. data/lib/attio/connection_pool.rb +69 -0
  73. data/lib/attio/errors.rb +9 -0
  74. data/lib/attio/http_client.rb +100 -0
  75. data/lib/attio/logger.rb +110 -0
  76. data/lib/attio/resources/attributes.rb +26 -0
  77. data/lib/attio/resources/base.rb +55 -0
  78. data/lib/attio/resources/lists.rb +56 -0
  79. data/lib/attio/resources/objects.rb +20 -0
  80. data/lib/attio/resources/records.rb +158 -0
  81. data/lib/attio/resources/users.rb +20 -0
  82. data/lib/attio/resources/workspaces.rb +13 -0
  83. data/lib/attio/retry_handler.rb +70 -0
  84. data/lib/attio/version.rb +3 -0
  85. data/lib/attio.rb +60 -0
  86. data/run_tests.rb +52 -0
  87. data/test_basic.rb +51 -0
  88. data/test_typhoeus.rb +31 -0
  89. metadata +160 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d16a0ed322b54b45b8e8651f2d3b2f374fe36d2b659f00de534731249ed3596a
4
+ data.tar.gz: 176579f8838f7368bc0d1dcc913aefe5d8b391c88299c137e63ca6b0e1be692d
5
+ SHA512:
6
+ metadata.gz: 3079f7053a1670151a438c1aeeeb69df7d1e4f1e496a15d1d863808d732f11420bbf6acbdf90ac3de37570d01cc4daf3bb25960fdbcb9812d423097d89cd3f8c
7
+ data.tar.gz: b70ce155192095a89affe6ccc894cb4d04f3679a3950b8402bafd5d96ff273f43e572ac4b0f589dad256a7ab0c826bc86556c5ab49bdab4b8b35085486721dfd
data/.codecov.yml ADDED
@@ -0,0 +1,52 @@
1
+ coverage:
2
+ precision: 2
3
+ round: down
4
+ range: "70...100"
5
+
6
+ status:
7
+ project:
8
+ default:
9
+ target: 85%
10
+ threshold: 1%
11
+ if_ci_failed: error
12
+ patch:
13
+ default:
14
+ target: 80%
15
+ threshold: 5%
16
+ if_ci_failed: error
17
+
18
+ comment:
19
+ layout: "reach,diff,flags,tree,reach"
20
+ behavior: default
21
+ require_changes: true
22
+ require_base: false
23
+ require_head: true
24
+
25
+ ignore:
26
+ - "spec/**/*"
27
+ - "test/**/*"
28
+ - "vendor/**/*"
29
+ - "bin/**/*"
30
+ - "docs/**/*"
31
+ - "coverage/**/*"
32
+ - "*.gemspec"
33
+ - "Gemfile"
34
+ - "Rakefile"
35
+ - "run_tests.rb"
36
+ - "test_*.rb"
37
+
38
+ github_checks:
39
+ annotations: true
40
+
41
+ flags:
42
+ unittests:
43
+ paths:
44
+ - lib/
45
+
46
+ parsers:
47
+ gcov:
48
+ branch_detection:
49
+ conditional: yes
50
+ loop: yes
51
+ method: no
52
+ macro: no
@@ -0,0 +1,28 @@
1
+ # Global ownership
2
+ * @ernest-codes
3
+
4
+ # Core library files
5
+ /lib/ @ernest-codes
6
+
7
+ # Configuration files
8
+ /.github/ @ernest-codes
9
+ /.rubocop.yml @ernest-codes
10
+ /.codecov.yml @ernest-codes
11
+ /Gemfile @ernest-codes
12
+ /attio.gemspec @ernest-codes
13
+ /Rakefile @ernest-codes
14
+
15
+ # Tests
16
+ /spec/ @ernest-codes
17
+
18
+ # Documentation
19
+ /README.md @ernest-codes
20
+ /CHANGELOG.md @ernest-codes
21
+ /docs/ @ernest-codes
22
+
23
+ # CI/CD workflows - require review for changes
24
+ /.github/workflows/ @ernest-codes
25
+ /.github/dependabot.yml @ernest-codes
26
+
27
+ # Security-sensitive files
28
+ /danger/ @ernest-codes
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: '[Bug] '
5
+ labels: ['bug']
6
+ assignees: ['ernest-codes']
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Initialize client with '...'
16
+ 2. Call method '....'
17
+ 3. See error
18
+
19
+ **Expected behavior**
20
+ A clear and concise description of what you expected to happen.
21
+
22
+ **Code Sample**
23
+ ```ruby
24
+ # Minimal code sample that demonstrates the issue
25
+ client = Attio::Client.new(api_key: "your_api_key")
26
+ # ... rest of your code
27
+ ```
28
+
29
+ **Environment:**
30
+ - OS: [e.g. macOS, Ubuntu]
31
+ - Ruby version: [e.g. 3.2.0]
32
+ - Gem version: [e.g. 1.0.0]
33
+
34
+ **Additional context**
35
+ Add any other context about the problem here.
36
+
37
+ **Error message (if applicable)**
38
+ ```
39
+ Paste the full error message here
40
+ ```
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: '[Feature] '
5
+ labels: ['enhancement']
6
+ assignees: ['ernest-codes']
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **API Reference (if applicable)**
20
+ Link to the relevant Attio API documentation: https://developers.attio.com/
21
+
22
+ **Additional context**
23
+ Add any other context or screenshots about the feature request here.
24
+
25
+ **Would you be willing to implement this feature?**
26
+ - [ ] Yes, I can implement this feature
27
+ - [ ] I need help implementing this feature
28
+ - [ ] I cannot implement this feature
@@ -0,0 +1,54 @@
1
+ version: 2
2
+ updates:
3
+ # Enable version updates for bundler
4
+ - package-ecosystem: "bundler"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "weekly"
8
+ day: "monday"
9
+ time: "09:00"
10
+ timezone: "UTC"
11
+ open-pull-requests-limit: 10
12
+ reviewers:
13
+ - "ernest-codes"
14
+ assignees:
15
+ - "ernest-codes"
16
+ commit-message:
17
+ prefix: "chore"
18
+ prefix-development: "chore"
19
+ include: "scope"
20
+ labels:
21
+ - "dependencies"
22
+ - "ruby"
23
+ # Group patch updates to reduce PR noise
24
+ groups:
25
+ patch-updates:
26
+ patterns:
27
+ - "*"
28
+ update-types:
29
+ - "patch"
30
+ minor-updates:
31
+ patterns:
32
+ - "*"
33
+ update-types:
34
+ - "minor"
35
+
36
+ # Enable version updates for GitHub Actions
37
+ - package-ecosystem: "github-actions"
38
+ directory: "/"
39
+ schedule:
40
+ interval: "weekly"
41
+ day: "monday"
42
+ time: "09:00"
43
+ timezone: "UTC"
44
+ open-pull-requests-limit: 5
45
+ reviewers:
46
+ - "ernest-codes"
47
+ assignees:
48
+ - "ernest-codes"
49
+ commit-message:
50
+ prefix: "ci"
51
+ include: "scope"
52
+ labels:
53
+ - "dependencies"
54
+ - "github-actions"
@@ -0,0 +1,40 @@
1
+ ## Description
2
+ Brief description of the changes in this PR.
3
+
4
+ ## Type of Change
5
+ - [ ] Bug fix (non-breaking change which fixes an issue)
6
+ - [ ] New feature (non-breaking change which adds functionality)
7
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
8
+ - [ ] Documentation update
9
+ - [ ] Performance improvement
10
+ - [ ] Code refactoring
11
+ - [ ] Test improvements
12
+ - [ ] CI/CD improvements
13
+
14
+ ## Related Issues
15
+ Closes #(issue number)
16
+
17
+ ## Changes Made
18
+ - Change 1
19
+ - Change 2
20
+ - Change 3
21
+
22
+ ## Testing
23
+ - [ ] All existing tests pass
24
+ - [ ] New tests added for new functionality
25
+ - [ ] Manual testing completed
26
+
27
+ ## Checklist
28
+ - [ ] My code follows the style guidelines of this project
29
+ - [ ] I have performed a self-review of my own code
30
+ - [ ] I have commented my code, particularly in hard-to-understand areas
31
+ - [ ] I have made corresponding changes to the documentation
32
+ - [ ] I have added tests that prove my fix is effective or that my feature works
33
+ - [ ] New and existing unit tests pass locally with my changes
34
+ - [ ] I have updated the CHANGELOG.md (if applicable)
35
+
36
+ ## Screenshots (if applicable)
37
+ Add screenshots to help explain your changes.
38
+
39
+ ## Additional Notes
40
+ Any additional information that reviewers should know.
@@ -0,0 +1,112 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ env:
10
+ RUBY_PLATFORM: ruby
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby-version: ['3.0', '3.1', '3.2', '3.3']
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+
23
+ - name: Set up Ruby ${{ matrix.ruby-version }}
24
+ uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: ${{ matrix.ruby-version }}
27
+ bundler-cache: true
28
+
29
+ - name: Create coverage directory
30
+ run: mkdir -p coverage
31
+
32
+ - name: Run tests
33
+ run: |
34
+ bundle exec rake coverage:report
35
+ env:
36
+ COVERAGE: true
37
+
38
+ - name: Upload coverage to Codecov
39
+ uses: codecov/codecov-action@v4
40
+ if: matrix.ruby-version == '3.3'
41
+ with:
42
+ files: ./coverage/coverage.xml,./coverage/.resultset.json
43
+ flags: unittests
44
+ name: codecov-umbrella
45
+ fail_ci_if_error: false
46
+ token: ${{ secrets.CODECOV_TOKEN }}
47
+
48
+ lint:
49
+ runs-on: ubuntu-latest
50
+
51
+ steps:
52
+ - uses: actions/checkout@v4
53
+
54
+ - name: Set up Ruby
55
+ uses: ruby/setup-ruby@v1
56
+ with:
57
+ ruby-version: '3.3'
58
+ bundler-cache: true
59
+
60
+ - name: Run RuboCop
61
+ run: bundle exec rubocop --parallel --format github
62
+
63
+ security:
64
+ runs-on: ubuntu-latest
65
+
66
+ steps:
67
+ - uses: actions/checkout@v4
68
+
69
+ - name: Set up Ruby
70
+ uses: ruby/setup-ruby@v1
71
+ with:
72
+ ruby-version: '3.3'
73
+ bundler-cache: true
74
+
75
+ - name: Run bundler-audit
76
+ run: |
77
+ bundle exec bundler-audit check --update
78
+ bundle exec bundler-audit check --format json --output bundler-audit.json || true
79
+
80
+ - name: Upload security scan results
81
+ uses: actions/upload-artifact@v4
82
+ if: always()
83
+ with:
84
+ name: security-scan-results
85
+ path: bundler-audit.json
86
+
87
+ build:
88
+ runs-on: ubuntu-latest
89
+
90
+ steps:
91
+ - uses: actions/checkout@v4
92
+
93
+ - name: Set up Ruby
94
+ uses: ruby/setup-ruby@v1
95
+ with:
96
+ ruby-version: '3.3'
97
+ bundler-cache: true
98
+
99
+ - name: Build gem
100
+ run: bundle exec gem build attio.gemspec
101
+
102
+ - name: Check gem installation
103
+ run: |
104
+ gem_file=$(ls attio-*.gem | head -1)
105
+ gem install "$gem_file"
106
+ ruby -e "require 'attio'; puts 'Gem loads successfully'"
107
+
108
+ - name: Upload gem artifact
109
+ uses: actions/upload-artifact@v4
110
+ with:
111
+ name: gem-build
112
+ path: attio-*.gem
@@ -0,0 +1,45 @@
1
+ name: Dependabot Auto-merge
2
+
3
+ on:
4
+ pull_request_target:
5
+ types: [opened, synchronize, reopened]
6
+
7
+ permissions:
8
+ contents: write
9
+ pull-requests: write
10
+
11
+ jobs:
12
+ auto-merge:
13
+ runs-on: ubuntu-latest
14
+ if: github.actor == 'dependabot[bot]'
15
+
16
+ steps:
17
+ - name: Check PR for auto-merge eligibility
18
+ id: check
19
+ run: |
20
+ # Only auto-merge patch updates
21
+ if [[ "${{ github.event.pull_request.title }}" =~ ^chore\(deps\):.*patch.*updates ]]; then
22
+ echo "eligible=true" >> $GITHUB_OUTPUT
23
+ else
24
+ echo "eligible=false" >> $GITHUB_OUTPUT
25
+ fi
26
+
27
+ - name: Enable auto-merge for patch updates
28
+ if: steps.check.outputs.eligible == 'true'
29
+ run: |
30
+ gh pr merge --auto --squash "${{ github.event.pull_request.number }}"
31
+ env:
32
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33
+ GH_REPO: ${{ github.repository }}
34
+
35
+ - name: Comment on minor/major updates
36
+ if: steps.check.outputs.eligible == 'false'
37
+ run: |
38
+ gh pr comment "${{ github.event.pull_request.number }}" --body "
39
+ 🤖 This is a minor or major dependency update that requires manual review.
40
+
41
+ Please review the changes and merge manually if everything looks good.
42
+ "
43
+ env:
44
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45
+ GH_REPO: ${{ github.repository }}
@@ -0,0 +1,145 @@
1
+ name: PR Checks
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize, edited]
6
+
7
+ jobs:
8
+ conventional-commits:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ with:
13
+ fetch-depth: 0
14
+
15
+ - name: Validate PR title
16
+ uses: amannn/action-semantic-pull-request@v5
17
+ env:
18
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19
+ with:
20
+ types: |
21
+ feat
22
+ fix
23
+ docs
24
+ style
25
+ refactor
26
+ perf
27
+ test
28
+ chore
29
+ ci
30
+ build
31
+ requireScope: false
32
+ disallowScopes: |
33
+ release
34
+ subjectPattern: ^(?![A-Z]).+$
35
+ subjectPatternError: |
36
+ The subject "{subject}" found in the pull request title "{title}"
37
+ didn't match the configured pattern. Please ensure that the subject
38
+ doesn't start with an uppercase character.
39
+
40
+ changelog-check:
41
+ runs-on: ubuntu-latest
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+ with:
45
+ fetch-depth: 0
46
+
47
+ - name: Check for changelog update
48
+ run: |
49
+ # Skip changelog check for certain PR types
50
+ pr_title="${{ github.event.pull_request.title }}"
51
+ if [[ $pr_title =~ ^(chore|ci|docs|style|test): ]]; then
52
+ echo "Skipping changelog check for $pr_title"
53
+ exit 0
54
+ fi
55
+
56
+ # Check if CHANGELOG.md was modified
57
+ if git diff --name-only origin/main...HEAD | grep -q "CHANGELOG.md"; then
58
+ echo "✅ CHANGELOG.md was updated"
59
+ else
60
+ echo "❌ Please update CHANGELOG.md with your changes"
61
+ echo "Add an entry under the ## [Unreleased] section"
62
+ exit 1
63
+ fi
64
+
65
+ gem-build-validation:
66
+ runs-on: ubuntu-latest
67
+ steps:
68
+ - uses: actions/checkout@v4
69
+
70
+ - name: Set up Ruby
71
+ uses: ruby/setup-ruby@v1
72
+ with:
73
+ ruby-version: '3.3'
74
+ bundler-cache: true
75
+
76
+ - name: Validate gemspec
77
+ run: |
78
+ bundle exec gem build attio.gemspec --strict
79
+ echo "✅ Gemspec is valid"
80
+
81
+ - name: Check gem installation
82
+ run: |
83
+ gem_file=$(ls attio-*.gem | head -1)
84
+ gem install "$gem_file"
85
+ ruby -c -e "require 'attio'"
86
+ echo "✅ Gem can be required successfully"
87
+
88
+ danger:
89
+ runs-on: ubuntu-latest
90
+ steps:
91
+ - uses: actions/checkout@v4
92
+ with:
93
+ fetch-depth: 0
94
+
95
+ - name: Set up Ruby
96
+ uses: ruby/setup-ruby@v1
97
+ with:
98
+ ruby-version: '3.3'
99
+ bundler-cache: true
100
+
101
+ - name: Run Danger
102
+ run: bundle exec danger
103
+ env:
104
+ DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105
+
106
+ security-check:
107
+ runs-on: ubuntu-latest
108
+ steps:
109
+ - uses: actions/checkout@v4
110
+
111
+ - name: Set up Ruby
112
+ uses: ruby/setup-ruby@v1
113
+ with:
114
+ ruby-version: '3.3'
115
+ bundler-cache: true
116
+
117
+ - name: Run security checks
118
+ run: |
119
+ bundle exec bundler-audit check --update
120
+ echo "✅ No known security vulnerabilities found"
121
+
122
+ pr-size-check:
123
+ runs-on: ubuntu-latest
124
+ steps:
125
+ - uses: actions/checkout@v4
126
+ with:
127
+ fetch-depth: 0
128
+
129
+ - name: Check PR size
130
+ run: |
131
+ files_changed=$(git diff --name-only origin/main...HEAD | wc -l)
132
+ lines_changed=$(git diff --shortstat origin/main...HEAD | awk '{print $4+$6}' || echo "0")
133
+
134
+ echo "Files changed: $files_changed"
135
+ echo "Lines changed: $lines_changed"
136
+
137
+ if [ "$files_changed" -gt 50 ]; then
138
+ echo "⚠️ This PR changes $files_changed files. Consider breaking it into smaller PRs."
139
+ fi
140
+
141
+ if [ "$lines_changed" -gt 1000 ]; then
142
+ echo "⚠️ This PR changes $lines_changed lines. Consider breaking it into smaller PRs."
143
+ fi
144
+
145
+ # Don't fail the check, just provide warnings
@@ -0,0 +1,147 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ env:
9
+ RUBY_PLATFORM: ruby
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ ruby-version: ['3.0', '3.1', '3.2', '3.3']
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+
22
+ - name: Set up Ruby ${{ matrix.ruby-version }}
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby-version }}
26
+ bundler-cache: true
27
+
28
+ - name: Run tests
29
+ run: bundle exec rspec
30
+
31
+ - name: Run RuboCop
32
+ if: matrix.ruby-version == '3.3'
33
+ run: bundle exec rubocop
34
+
35
+ build-and-publish:
36
+ needs: test
37
+ runs-on: ubuntu-latest
38
+ permissions:
39
+ contents: write
40
+ packages: write
41
+
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+ with:
45
+ fetch-depth: 0
46
+
47
+ - name: Set up Ruby
48
+ uses: ruby/setup-ruby@v1
49
+ with:
50
+ ruby-version: '3.3'
51
+ bundler-cache: true
52
+
53
+ - name: Extract version from tag
54
+ id: version
55
+ run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
56
+
57
+ - name: Build gem
58
+ run: |
59
+ bundle exec gem build attio.gemspec
60
+ echo "GEM_FILE=$(ls attio-*.gem)" >> $GITHUB_ENV
61
+
62
+ - name: Publish to RubyGems
63
+ run: |
64
+ mkdir -p ~/.gem
65
+ cat << 'EOF' > ~/.gem/credentials
66
+ ---
67
+ :rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}
68
+ EOF
69
+ chmod 0600 ~/.gem/credentials
70
+ gem push ${{ env.GEM_FILE }}
71
+
72
+ - name: Generate changelog
73
+ id: changelog
74
+ run: |
75
+ if [ -f CHANGELOG.md ]; then
76
+ # Extract changelog section for this version
77
+ awk "/^## \[?${{ steps.version.outputs.version }}\]?/ {flag=1; next} /^## / && flag {flag=0} flag" CHANGELOG.md > release_changelog.md
78
+ if [ -s release_changelog.md ]; then
79
+ echo "changelog_content<<EOF" >> $GITHUB_OUTPUT
80
+ cat release_changelog.md >> $GITHUB_OUTPUT
81
+ echo "EOF" >> $GITHUB_OUTPUT
82
+ else
83
+ echo "changelog_content=Release ${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT
84
+ fi
85
+ else
86
+ echo "changelog_content=Release ${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT
87
+ fi
88
+
89
+ - name: Create GitHub Release
90
+ id: create_release
91
+ uses: actions/create-release@v1
92
+ env:
93
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94
+ with:
95
+ tag_name: ${{ github.ref }}
96
+ release_name: Release ${{ steps.version.outputs.version }}
97
+ body: ${{ steps.changelog.outputs.changelog_content }}
98
+ draft: false
99
+ prerelease: false
100
+
101
+ - name: Upload gem to release
102
+ uses: actions/upload-release-asset@v1
103
+ env:
104
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105
+ with:
106
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
107
+ asset_path: ${{ env.GEM_FILE }}
108
+ asset_name: ${{ env.GEM_FILE }}
109
+ asset_content_type: application/x-tar
110
+
111
+ update-docs:
112
+ needs: [test, build-and-publish]
113
+ runs-on: ubuntu-latest
114
+ permissions:
115
+ contents: write
116
+
117
+ steps:
118
+ - uses: actions/checkout@v4
119
+ with:
120
+ token: ${{ secrets.GITHUB_TOKEN }}
121
+ ref: main
122
+
123
+ - name: Set up Ruby
124
+ uses: ruby/setup-ruby@v1
125
+ with:
126
+ ruby-version: '3.3'
127
+ bundler-cache: true
128
+
129
+ - name: Extract version from tag
130
+ id: version
131
+ run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
132
+
133
+ - name: Generate documentation
134
+ run: |
135
+ bundle exec rake docs:generate
136
+
137
+ - name: Commit and push documentation
138
+ run: |
139
+ git config --local user.email "action@github.com"
140
+ git config --local user.name "GitHub Action"
141
+ git add docs/
142
+ if ! git diff --staged --quiet; then
143
+ git commit -m "Update documentation for release ${{ steps.version.outputs.version }}"
144
+ git push
145
+ else
146
+ echo "No documentation changes to commit"
147
+ fi