Extract auto-update workflow for default gems on NEWS.md
We should stop it until final release of Ruby.
This commit is contained in:
parent
50282a540a
commit
dd1208afa7
Notes:
git
2024-12-18 07:45:27 +00:00
59
.github/workflows/check_misc.yml
vendored
59
.github/workflows/check_misc.yml
vendored
@ -52,65 +52,6 @@ jobs:
|
|||||||
exit $fail
|
exit $fail
|
||||||
working-directory: include
|
working-directory: include
|
||||||
|
|
||||||
- id: gems
|
|
||||||
run: true
|
|
||||||
if: ${{ github.ref == 'refs/heads/master' }}
|
|
||||||
|
|
||||||
- name: Download previous gems list
|
|
||||||
run: |
|
|
||||||
data=default_gems.json
|
|
||||||
mkdir -p .downloaded-cache
|
|
||||||
ln -s .downloaded-cache/$data .
|
|
||||||
curl -O -R -z ./$data https://stdgems.org/$data
|
|
||||||
if: ${{ steps.gems.outcome == 'success' }}
|
|
||||||
|
|
||||||
- name: Make default gems list
|
|
||||||
run: |
|
|
||||||
#!ruby
|
|
||||||
require 'rubygems'
|
|
||||||
$:.unshift "lib"
|
|
||||||
rgver = File.foreach("lib/rubygems.rb") do |line|
|
|
||||||
break $1 if /^\s*VERSION\s*=\s*"([^"]+)"/ =~ line
|
|
||||||
end
|
|
||||||
gems = Dir.glob("{ext,lib}/**/*.gemspec").map do |f|
|
|
||||||
spec = Gem::Specification.load(f)
|
|
||||||
"#{spec.name} #{spec.version}"
|
|
||||||
end.sort
|
|
||||||
File.open("gems/default_gems", "w") do |f|
|
|
||||||
f.puts "RubyGems #{rgver}"
|
|
||||||
f.puts gems
|
|
||||||
end
|
|
||||||
shell: ruby --disable=gems {0}
|
|
||||||
if: ${{ steps.gems.outcome == 'success' }}
|
|
||||||
|
|
||||||
- name: Maintain updated gems list in NEWS
|
|
||||||
run: |
|
|
||||||
ruby tool/update-NEWS-gemlist.rb default
|
|
||||||
if: ${{ steps.gems.outcome == 'success' }}
|
|
||||||
|
|
||||||
- name: Check diffs
|
|
||||||
id: diff
|
|
||||||
run: |
|
|
||||||
git diff --color --no-ext-diff --ignore-submodules --exit-code NEWS.md ||
|
|
||||||
echo update=true >> $GITHUB_OUTPUT
|
|
||||||
if: ${{ steps.gems.outcome == 'success' }}
|
|
||||||
|
|
||||||
- name: Commit
|
|
||||||
run: |
|
|
||||||
git pull --ff-only origin ${GITHUB_REF#refs/heads/}
|
|
||||||
git commit --message="Update default gems list at ${GITHUB_SHA:0:30} [ci skip]" NEWS.md
|
|
||||||
git push origin ${GITHUB_REF#refs/heads/}
|
|
||||||
env:
|
|
||||||
EMAIL: svn-admin@ruby-lang.org
|
|
||||||
GIT_AUTHOR_NAME: git
|
|
||||||
GIT_COMMITTER_NAME: git
|
|
||||||
if: >-
|
|
||||||
${{
|
|
||||||
github.repository == 'ruby/ruby' &&
|
|
||||||
!startsWith(github.event_name, 'pull') &&
|
|
||||||
steps.diff.outputs.update
|
|
||||||
}}
|
|
||||||
|
|
||||||
- name: Generate docs
|
- name: Generate docs
|
||||||
id: docs
|
id: docs
|
||||||
run: |
|
run: |
|
||||||
|
93
.github/workflows/default_gems.yml
vendored
Normal file
93
.github/workflows/default_gems.yml
vendored
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
name: Update default gems list
|
||||||
|
on: [push, pull_request, merge_group]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
|
||||||
|
cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update_default_gems:
|
||||||
|
name: Update default gems list
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write # for Git to git push
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
|
||||||
|
with:
|
||||||
|
token: ${{ (github.repository == 'ruby/ruby' && !startsWith(github.event_name, 'pull')) && secrets.MATZBOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- uses: ./.github/actions/setup/directories
|
||||||
|
with:
|
||||||
|
makeup: true
|
||||||
|
# Skip overwriting MATZBOT_GITHUB_TOKEN
|
||||||
|
checkout: '' # false (ref: https://github.com/actions/runner/issues/2238)
|
||||||
|
|
||||||
|
- id: gems
|
||||||
|
run: true
|
||||||
|
if: ${{ github.ref == 'refs/heads/master' }}
|
||||||
|
|
||||||
|
- name: Download previous gems list
|
||||||
|
run: |
|
||||||
|
data=default_gems.json
|
||||||
|
mkdir -p .downloaded-cache
|
||||||
|
ln -s .downloaded-cache/$data .
|
||||||
|
curl -O -R -z ./$data https://stdgems.org/$data
|
||||||
|
if: ${{ steps.gems.outcome == 'success' }}
|
||||||
|
|
||||||
|
- name: Make default gems list
|
||||||
|
run: |
|
||||||
|
#!ruby
|
||||||
|
require 'rubygems'
|
||||||
|
$:.unshift "lib"
|
||||||
|
rgver = File.foreach("lib/rubygems.rb") do |line|
|
||||||
|
break $1 if /^\s*VERSION\s*=\s*"([^"]+)"/ =~ line
|
||||||
|
end
|
||||||
|
gems = Dir.glob("{ext,lib}/**/*.gemspec").map do |f|
|
||||||
|
spec = Gem::Specification.load(f)
|
||||||
|
"#{spec.name} #{spec.version}"
|
||||||
|
end.sort
|
||||||
|
File.open("gems/default_gems", "w") do |f|
|
||||||
|
f.puts "RubyGems #{rgver}"
|
||||||
|
f.puts gems
|
||||||
|
end
|
||||||
|
shell: ruby --disable=gems {0}
|
||||||
|
if: ${{ steps.gems.outcome == 'success' }}
|
||||||
|
|
||||||
|
- name: Maintain updated gems list in NEWS
|
||||||
|
run: |
|
||||||
|
ruby tool/update-NEWS-gemlist.rb default
|
||||||
|
if: ${{ steps.gems.outcome == 'success' }}
|
||||||
|
|
||||||
|
- name: Check diffs
|
||||||
|
id: diff
|
||||||
|
run: |
|
||||||
|
git diff --color --no-ext-diff --ignore-submodules --exit-code NEWS.md ||
|
||||||
|
echo update=true >> $GITHUB_OUTPUT
|
||||||
|
if: ${{ steps.gems.outcome == 'success' }}
|
||||||
|
|
||||||
|
- name: Commit
|
||||||
|
run: |
|
||||||
|
git pull --ff-only origin ${GITHUB_REF#refs/heads/}
|
||||||
|
git commit --message="Update default gems list at ${GITHUB_SHA:0:30} [ci skip]" NEWS.md
|
||||||
|
git push origin ${GITHUB_REF#refs/heads/}
|
||||||
|
env:
|
||||||
|
EMAIL: svn-admin@ruby-lang.org
|
||||||
|
GIT_AUTHOR_NAME: git
|
||||||
|
GIT_COMMITTER_NAME: git
|
||||||
|
if: >-
|
||||||
|
${{
|
||||||
|
github.repository == 'ruby/ruby' &&
|
||||||
|
!startsWith(github.event_name, 'pull') &&
|
||||||
|
steps.diff.outputs.update
|
||||||
|
}}
|
||||||
|
|
||||||
|
- uses: ./.github/actions/slack
|
||||||
|
with:
|
||||||
|
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
|
||||||
|
if: ${{ failure() }}
|
Loading…
x
Reference in New Issue
Block a user