generated from actions/javascript-action
-
-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to automatically create a release
- Loading branch information
Showing
3 changed files
with
39 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
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 | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" |