Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] create a stage release workflow for after the pre-release PR #14122

Merged
merged 3 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/stage-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Release Staging

on:
pull_request:
types: [closed]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
github-release:
if: >
github.event.pull_request.merged == true &&
github.repository_owner == 'seleniumhq' &&
startsWith(github.event.pull_request.head.ref, 'release-preparation-')
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Extract version from branch name
id: extract_version
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=$(echo $BRANCH_NAME | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Prep git
run: |
git config --local user.email "[email protected]"
git config --local user.name "Selenium CI Bot"
- name: Tag Release
run: |
git tag selenium-${{ env.VERSION }}
git push origin selenium-${{ env.VERSION }}
- name: Update Nightly Tag to Remove pre-release
run: |
git fetch --tags
git tag -d nightly || echo "Nightly tag not found"
git tag nightly
git push origin refs/tags/nightly --force
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Build and Stage Packages
run: ./go all:package[--config=release]
- name: Generate Draft Release
uses: softprops/action-gh-release@v2
with:
name: Selenium ${{ env.VERSION }}
body: |
## Detailed Changelogs by Component
<img src="https://www.selenium.dev/images/programming/java.svg" width="20" height="20"> **[Java](https://github.com/SeleniumHQ/selenium/blob/trunk/java/CHANGELOG)** &nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;<img src="https://www.selenium.dev/images/programming/python.svg" width="20" height="20"> **[Python](https://github.com/SeleniumHQ/selenium/blob/trunk/py/CHANGES)** &nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;<img src="https://www.selenium.dev/images/programming/csharp.svg" width="20" height="20"> **[DotNet](https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/CHANGELOG)** &nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;<img src="https://www.selenium.dev/images/programming/ruby.svg" width="20" height="20"> **[Ruby](https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES)** &nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;<img src="https://www.selenium.dev/images/programming/javascript.svg" width="20" height="20"> **[JavaScript](https://github.com/SeleniumHQ/selenium/blob/trunk/javascript/node/selenium-webdriver/CHANGES.md)** &nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;<img src="https://www.selenium.dev/images/browsers/internet-explorer.svg" width="20" height="20"> **[IEDriver](https://github.com/SeleniumHQ/selenium/blob/trunk/cpp/iedriverserver/CHANGELOG)**
<br>
tag_name: selenium-${{ env.VERSION }}
draft: true
generate_release_notes: true
prerelease: false
files: build/dist/*.*
43 changes: 7 additions & 36 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -1035,19 +1035,23 @@ namespace :all do
Rake::Task['node:build'].invoke(*args)
end

desc 'Package or build stamped artifacts for distribution in GitHub Release assets'
task :package do |_task, arguments|
args = arguments.to_a.compact
Rake::Task['java:package'].invoke(*args)
Rake::Task['dotnet:package'].invoke(*args)
end

desc 'Release all artifacts for all language bindings'
task :release do |_task, arguments|
Rake::Task['clean'].invoke
tag = @git.add_tag("selenium-#{java_version}")
@git.push('origin', tag.name)

args = arguments.to_a.compact.empty? ? ['--stamp'] : arguments.to_a.compact
Rake::Task['java:release'].invoke(*args)
Rake::Task['py:release'].invoke(*args)
Rake::Task['rb:release'].invoke(*args)
Rake::Task['dotnet:release'].invoke(*args)
Rake::Task['node:release'].invoke(*args)
Rake::Task['create_release_notes'].invoke
Rake::Task['all:docs'].invoke
Rake::Task['all:version'].invoke('nightly')

Expand Down Expand Up @@ -1140,39 +1144,6 @@ at_exit do
system 'sh', '.git-fixfiles' if File.exist?('.git') && !SeleniumRake::Checks.windows?
end

desc 'Create Release Notes for Minor Release'
task :create_release_notes do
range = "#{previous_tag(java_version)}...HEAD"
format = '* [\\`%h\\`](http://github.com/seleniumhq/selenium/commit/%H) - %s :: %aN'
git_log_command = %(git --no-pager log "#{range}" --pretty=format:"#{format}" --reverse)
git_log_output = `#{git_log_command}`

release_notes = <<~RELEASE_NOTES
### Changelog

For each component's detailed changelog, please check:
* [Ruby](https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES)
* [Python](https://github.com/SeleniumHQ/selenium/blob/trunk/py/CHANGES)
* [JavaScript](https://github.com/SeleniumHQ/selenium/blob/trunk/javascript/node/selenium-webdriver/CHANGES.md)
* [Java](https://github.com/SeleniumHQ/selenium/blob/trunk/java/CHANGELOG)
* [DotNet](https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/CHANGELOG)
* [IEDriverServer](https://github.com/SeleniumHQ/selenium/blob/trunk/cpp/iedriverserver/CHANGELOG)

### Commits in this release
<details>
<summary>Click to see all the commits included in this release</summary>

#{git_log_output}

</details>
RELEASE_NOTES

FileUtils.mkdir_p('build/dist')
release_notes_file = "build/dist/release_notes_#{java_version}.md"
File.write(release_notes_file, release_notes)
puts "Release notes have been generated at: #{release_notes_file}"
end

def updated_version(current, desired = nil, nightly = nil)
if !desired.nil? && desired != 'nightly'
# If desired is present, return full 3 digit version
Expand Down
Loading