Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ruby/setup-ruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.181.0
Choose a base ref
...
head repository: ruby/setup-ruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.182.0
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Jun 27, 2024

  1. Add workflow to automatically create a release

    eregon committed Jun 27, 2024
    Copy the full SHA
    3251c5c View commit details
  2. GH_REPO and GH_TOKEN must be set

    eregon committed Jun 27, 2024
    Copy the full SHA
    af43264 View commit details
Showing with 42 additions and 7 deletions.
  1. +10 −7 .github/workflows/release.yml
  2. +15 −0 .github/workflows/update-v1-branch.yml
  3. +17 −0 release.rb
17 changes: 10 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
name: Update the v1 branch when a release is published
name: Create a Release
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
contents: write # for creating release

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write # for git push
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git push origin HEAD:v1
- uses: ./
with:
ruby-version: '3.3'
- run: ruby release.rb
15 changes: 15 additions & 0 deletions .github/workflows/update-v1-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Update the v1 branch when a release is published
on:
release:
types: [published]
permissions:
contents: write # for git push

jobs:
update_branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git push origin HEAD:v1
17 changes: 17 additions & 0 deletions release.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'json'

def run(command_line)
puts "$ #{command_line}"
output = `#{command_line}`
puts output
raise $?.inspect unless $?.success?
output
end

latest_release_tag = run 'gh release view --json tagName'
latest_release_tag = JSON.load(latest_release_tag).fetch('tagName')

raise latest_release_tag unless latest_release_tag =~ /\Av(\d+).(\d+).(\d+)\z/
tag = "v#{$1}.#{Integer($2)+1}.0"

run "gh release create --generate-notes --latest #{tag}"