diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc9430850..c93e1c161 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,6 +86,8 @@ jobs: if: github.ref == 'refs/heads/main' env: BUNDLE_APP_CONFIG: .bundle + GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }} + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 @@ -97,3 +99,5 @@ jobs: with: cmd: install - run: npx semantic-release + env: + BUNDLE_FROZEN: false diff --git a/.github/workflows/semantic.yml b/.github/workflows/semantic.yml index bf3f95d9d..1cde66065 100644 --- a/.github/workflows/semantic.yml +++ b/.github/workflows/semantic.yml @@ -1,12 +1,9 @@ name: "Semantic Pull Request" on: - pull_request_target: - types: - - opened - - edited - - synchronize - - reopened + pull_request: + branches: + - main permissions: pull-requests: write @@ -44,3 +41,76 @@ jobs: with: header: pr-title-lint-error delete: true + + semantic-versioning: + name: Report semantic changelog + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run install + uses: borales/actions-yarn@v4 + with: + cmd: install + - name: Check semantic versioning + id: semantic-release + run: | + GITHUB_REF=${{ github.head_ref }} + npx semantic-release --no-ci --dry-run --plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator --branches ${{ github.head_ref }} > output.txt + OUTPUT=$(cat output.txt | base64 -w 0) + echo "::set-output name=releaseNote::$OUTPUT" + + - name: Report semantic versioning + uses: actions/github-script@v3 + if: ${{ steps.semantic-release.outputs.releaseNote != '' }} + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + // build release note + const semanticReleaseOutput = Buffer.from('${{ steps.semantic-release.outputs.releaseNote }}', 'base64').toString('utf8'); + const semanticReleaseLogMatch = /^[[0-9:\sAMPM]+\]\s\[semantic-release\].*$/; + const lines = semanticReleaseOutput.split('\n'); + const lastSemanticReleaseLogIndex = [...lines] + .reverse() + .findIndex((line) => line.match(semanticReleaseLogMatch)); + + const releaseNoteIndex = lines.length - lastSemanticReleaseLogIndex; + const releaseNote = lines.slice(releaseNoteIndex); + + let res = releaseNote.join('\n'); + if (!releaseNote.length || !res) { + res = '### No release note would be generated.'; + } + + const SEMANTIC_RELEASE_BODY_HEADER = '## 📝 Semantic Release Report'; + const body = [SEMANTIC_RELEASE_BODY_HEADER, res].join('\n'); + + // get last comment + const comments = await github.issues.listComments({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo + }); + + // find comments to delete + const commentsToDelete = comments.data.filter((comment) => + comment.body.startsWith(SEMANTIC_RELEASE_BODY_HEADER) + ); + + // delete comments + const prms = commentsToDelete.map((comment) => + github.issues.deleteComment({ + comment_id: comment.id, + owner: context.repo.owner, + repo: context.repo.repo + }) + ); + + await Promise.all(prms); + + // create new comment for release note + github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body + }); \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index be63ccfd3..ff8d55782 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [3.9.0](https://github.com/mondaycom/apollo-federation-ruby/compare/v3.8.5...v3.9.0) (2024-11-20) + + +### Features + +* add [@policy](https://github.com/policy) and respect federation_version in link ([410ef6c](https://github.com/mondaycom/apollo-federation-ruby/commit/410ef6c99efc5e33b9c0cdd29161fc7451ae3a88)) + ## [3.8.5](https://github.com/Gusto/apollo-federation-ruby/compare/v3.8.4...v3.8.5) (2024-04-02) diff --git a/Gemfile b/Gemfile index e98de22f8..1deeb8021 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,5 @@ source 'https://rubygems.org' gemspec -# Fixes an issue in ruby 3.2, remove when a new version is published -gem 'appraisal', git: 'https://github.com/thoughtbot/appraisal', ref: 'ea2baff57bc7f9e5f9e7a648916c9ae536325116' +gem 'appraisal', '~> 2.5.0' gem 'graphql', '~> 2.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index d3283783d..d32c6d11b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,69 +1,85 @@ -GIT - remote: https://github.com/thoughtbot/appraisal - revision: ea2baff57bc7f9e5f9e7a648916c9ae536325116 - ref: ea2baff57bc7f9e5f9e7a648916c9ae536325116 - specs: - appraisal (2.4.1) - bundler - rake - thor (>= 0.14.0) - PATH remote: . specs: - apollo-federation (3.8.5) + apollo-federation (3.9.0) google-protobuf (~> 3.22) graphql (>= 1.10.14) GEM remote: https://rubygems.org/ specs: - actionpack (7.0.4.3) - actionview (= 7.0.4.3) - activesupport (= 7.0.4.3) - rack (~> 2.0, >= 2.2.0) + actionpack (7.1.5) + actionview (= 7.1.5) + activesupport (= 7.1.5) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actionview (7.0.4.3) - activesupport (= 7.0.4.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actionview (7.1.5) + activesupport (= 7.1.5) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activesupport (7.0.4.3) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activesupport (7.1.5) + base64 + benchmark (>= 0.3) + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) + mutex_m + securerandom (>= 0.3) tzinfo (~> 2.0) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) ast (2.4.2) - builder (3.2.4) + base64 (0.2.0) + benchmark (0.4.0) + bigdecimal (3.1.8) + builder (3.3.0) byebug (11.1.3) coderay (1.1.3) - concurrent-ruby (1.2.2) + concurrent-ruby (1.3.4) + connection_pool (2.4.1) crass (1.0.6) - diff-lcs (1.5.0) - erubi (1.12.0) - google-protobuf (3.22.2) - graphql (2.0.19) - i18n (1.12.0) + diff-lcs (1.5.1) + drb (2.2.1) + erubi (1.13.0) + google-protobuf (3.25.5) + google-protobuf (3.25.5-arm64-darwin) + google-protobuf (3.25.5-x86_64-darwin) + google-protobuf (3.25.5-x86_64-linux) + graphql (2.0.31) + base64 + i18n (1.14.6) concurrent-ruby (~> 1.0) - json (2.8.1) + json (2.8.2) language_server-protocol (3.17.0.3) - loofah (2.19.1) + logger (1.6.1) + loofah (2.23.1) crass (~> 1.0.2) - nokogiri (>= 1.5.9) - method_source (1.0.0) - mini_portile2 (2.8.7) - minitest (5.18.0) - nokogiri (1.14.2) - mini_portile2 (~> 2.8.0) + nokogiri (>= 1.12.0) + method_source (1.1.0) + mini_portile2 (2.8.8) + minitest (5.25.1) + mutex_m (0.3.0) + nokogiri (1.15.6) + mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.14.2-arm64-darwin) + nokogiri (1.15.6-arm64-darwin) racc (~> 1.4) - nokogiri (1.14.2-x86_64-darwin) + nokogiri (1.15.6-x86_64-darwin) racc (~> 1.4) - nokogiri (1.14.2-x86_64-linux) + nokogiri (1.15.6-x86_64-linux) racc (~> 1.4) parallel (1.26.3) parser (3.3.6.0) @@ -76,30 +92,34 @@ GEM byebug (~> 11.0) pry (>= 0.13, < 0.15) racc (1.8.1) - rack (2.2.6.4) + rack (3.1.8) + rack-session (2.0.0) + rack (>= 3.0.0) rack-test (2.1.0) rack (>= 1.3) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.5.0) - loofah (~> 2.19, >= 2.19.1) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) rainbow (3.1.1) - rake (13.0.6) + rake (13.2.1) regexp_parser (2.9.2) - rspec (3.12.0) - rspec-core (~> 3.12.0) - rspec-expectations (~> 3.12.0) - rspec-mocks (~> 3.12.0) - rspec-core (3.12.1) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.2) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-mocks (3.12.4) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-support (3.12.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.1) rubocop (1.68.0) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -115,11 +135,12 @@ GEM rubocop-rspec (3.2.0) rubocop (~> 1.61) ruby-progressbar (1.13.0) - thor (1.2.1) + securerandom (0.3.2) + thor (1.3.2) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.6.0) - webrick (1.8.1) + webrick (1.9.0) PLATFORMS arm64-darwin-21 @@ -133,7 +154,7 @@ PLATFORMS DEPENDENCIES actionpack apollo-federation! - appraisal! + appraisal (~> 2.5.0) graphql (~> 2.0.0) pry-byebug rack diff --git a/lib/apollo-federation/version.rb b/lib/apollo-federation/version.rb index c546694d1..4b7f492ef 100644 --- a/lib/apollo-federation/version.rb +++ b/lib/apollo-federation/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module ApolloFederation - VERSION = '3.8.5' + VERSION = '3.9.0' end