diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml new file mode 100644 index 000000000000..95686d4bf09a --- /dev/null +++ b/.github/workflows/merge.yaml @@ -0,0 +1,91 @@ +name: Merge to release + +on: + push: + branches: + - master + workflow_dispatch: + inputs: + commit_message: + description: Commit message + required: true + +jobs: + release: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + steps: + - uses: actions/checkout@v2 + if: github.event_name == 'push' + - uses: actions/checkout@v2 + if: github.event_name == 'workflow_dispatch' + with: + fetch-depth: 0 + + - name: Checkout release branch + uses: actions/checkout@v2 + with: + ref: 'v1.0.1' + path: './release' + + - name: Check for relevant changes + if: github.event_name == 'push' + uses: dorny/paths-filter@v2 + id: release + with: + list-files: shell + filters: | + updated: + - added|modified: [ '*.csl', '*.xml' ] + deleted: + - deleted: [ '*.csl', '*.xml' ] + + - name: Changed files + if: github.event_name == 'push' + run: | + echo updated: ${{ steps.release.outputs.updated_files }} + echo deleted: ${{ steps.release.outputs.deleted_files }} + + - name: Set up Ruby + if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.release.outputs.updated == 'true' || steps.release.outputs.deleted == 'true')) + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7.1 + - name: but use cache to speed that up + if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.release.outputs.updated == 'true' || steps.release.outputs.deleted == 'true')) + uses: actions/cache@v2 + with: + path: vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gems- + - name: Bundle install + if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.release.outputs.updated == 'true' || steps.release.outputs.deleted == 'true')) + run: | + bundle config path vendor/bundle + bundle update sheldon --jobs 4 --retry 3 + + - name: Populate new branch + run: bundle exec sheldon --token=$GITHUB_TOKEN --verbose --populate release + if: github.event_name == 'workflow_dispatch' + + - name: update the timestamps and add the changes + run: bundle exec sheldon --token=$GITHUB_TOKEN --verbose --release release ${{ steps.release.outputs.updated_files }} + if: github.event_name == 'push' && steps.release.outputs.updated == 'true' + + - name: delete deleted files + run: cd release && git rm ${{ steps.release.outputs.deleted_files }} + if: github.event_name == 'push' && steps.release.outputs.deleted == 'true' + + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + repository: 'release' + commit_message: Releasing ${{ steps.release.outputs.updated_files }} ${{ steps.release.outputs.deleted_files }} + if: github.event_name == 'push' && (steps.release.outputs.updated == 'true' || steps.release.outputs.deleted == 'true') + + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + repository: 'release' + commit_message: ${{ github.event.inputs.commit_message }} + if: github.event_name == 'workflow_dispatch' diff --git a/.github/workflows/sheldon.yaml b/.github/workflows/sheldon.yaml new file mode 100644 index 000000000000..e5140ee012f2 --- /dev/null +++ b/.github/workflows/sheldon.yaml @@ -0,0 +1,61 @@ +name: Pull request feedback + +on: + pull_request_target: + types: [ opened, synchronize ] + +jobs: + test: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + steps: + - uses: actions/checkout@v2 + + - name: Check for relevant changes + uses: dorny/paths-filter@v2 + id: sheldon + with: + list-files: shell + filters: | + changed: + - '*.csl' + + - name: Changed files + run: | + echo changed: ${{ steps.sheldon.outputs.changed_files }} + + - name: Set up Ruby + if: steps.sheldon.outputs.changed == 'true' + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7.1 + - name: but use cache to speed that up + if: steps.sheldon.outputs.changed == 'true' + uses: actions/cache@v2 + with: + path: vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gems- + - name: Bundle install + if: steps.sheldon.outputs.changed == 'true' + run: | + bundle config path vendor/bundle + bundle update sheldon --jobs 4 --retry 3 + + - name: Apply the PR + if: steps.sheldon.outputs.changed == 'true' + run: bundle exec sheldon --token=$GITHUB_TOKEN --apply + + - name: Welcome to a new PR + if: github.event.action == 'opened' && steps.sheldon.outputs.changed == 'true' + run: bundle exec sheldon --token=$GITHUB_TOKEN --welcome + + - name: See if the styles work + if: steps.sheldon.outputs.changed == 'true' + run: bundle exec rake + + - name: report + if: (failure() || success()) && steps.sheldon.outputs.changed == 'true' + run: bundle exec sheldon --token=$GITHUB_TOKEN --report --verbose diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 724298fd1efa..000000000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -dist: focal -language: ruby -cache: bundler -rvm: -- 2.7.1 -install: -- bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle} -- bundle update sheldon -notifications: - email: - on_success: change - on_failure: always - recipients: - - secure: Ko9SzcdByE/HOMP7s9ddTpRdqahnO5LJ1MGJWX/cmymQc8fDRMgP9jgI6D/G5Ntgo6uGUO+xkcV5mBbOAoI5v8U2GQ5nICDXHdQrX8kJzve9JDiQJOy0c17TYi3d7bBeS1bOhy7E0TxHRax2wWWxDhqz80GwSo9JAhQbcusR/1U= - - secure: Ov0xcwOVBSbc7uuCk0Qu+ILmh3HuFNa9PnfI363at9V3aG05oJHiTRseFXvfiHgK5663Wcytcl3DU+A2vYZSz7Y3ZGzcUzhlRBLMUfebncB2nAsX3NJsieJ6FoYlkRBZdzA2lzt3FVv99hebuZnU4OiANdnHFiLmFzeWRaPZfIQ= - webhooks: - urls: - - https://shelbot.herokuapp.com/build - - https://styles-update.zotero.org:8826/ - - https://styles-update.zotero.org:8827/ - on_success: always - on_failure: always - on_start: never diff --git a/Gemfile.lock b/Gemfile.lock index 69f6fbab0b50..b220ca304d28 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/citation-style-language/Sheldon.git - revision: 7822dbda11e229cbd933f84a3a1cfdbe8e75dfaf + revision: 1962fad73610a3e0b1610e0c24c16669d584196b specs: sheldon (1.0.2) citeproc-ruby diff --git a/Rakefile b/Rakefile index f284116cdca4..1f29f3380dfe 100644 --- a/Rakefile +++ b/Rakefile @@ -7,20 +7,10 @@ rescue Bundler::BundlerError => e exit e.status_code end -if ENV['TRAVIS'] - at_exit do - system('bundle exec sheldon') - end -end - require 'rspec/core' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |spec| - if ENV['TRAVIS'] - spec.rspec_opts = %w{ --require spec_helper.rb --format Fuubar --color --format json --out spec/sheldon/travis.json } - else - spec.rspec_opts = %w{ --require spec_helper.rb --format Fuubar --color --format json --out spec/sheldon/travis.json } - end + spec.rspec_opts = %w{ --require spec_helper.rb --format Fuubar --color --format json --out spec/sheldon/ci.json } end task :default => [:spec]